Skip to content

fix(action): honor exit codes under bash -e (restore set +e)#11

Merged
cemililik merged 1 commit into
mainfrom
fix/action-errexit-handling
May 25, 2026
Merged

fix(action): honor exit codes under bash -e (restore set +e)#11
cemililik merged 1 commit into
mainfrom
fix/action-errexit-handling

Conversation

@cemililik
Copy link
Copy Markdown
Collaborator

Problem

GitHub runs shell: bash steps with errexit — bash --noprofile --norc -e -o pipefail {0}. leakwatch legitimately exits 1 when it reports findings, so the action's Run scan step aborted at the leakwatch call before the exit-code mapping ran. Consequences on main (merged in #10):

  • fail-on-findings: false was effectively ignored — any findings failed the step.
  • findings-count / sarif-file outputs and the job summary were not produced on a findings run.
  • The cli-github-format self-test's out="$(leakwatch …)" capture aborted the same way.

The pre-rewrite action had set +e around the scan; it was dropped during the Marketplace rewrite. CI (action-test) caught it.

Fix

  • action.yml: set +e immediately before the leakwatch call so the script maps 0 / 1 / >=2 itself (the explicit mapping already exists below).
  • .github/workflows/action-test.yml (cli-github-format): || true on the output capture so it doesn't abort under -e either.

Verification

Reproduced GitHub's bash -e -o pipefail locally: without the fix the mapping is skipped and the step exits 1; with it the mapping runs and fail-on-findings is honored. actionlint + shellcheck clean. The run-action (with fail-on-findings: false) and cli-github-format self-test jobs are the regression guards.

🤖 Generated with Claude Code

…r bash -e

GitHub runs `shell: bash` steps with -e (`bash --noprofile --norc -e -o pipefail`).
leakwatch legitimately exits 1 when it reports findings, so the scan aborted the
step *before* the exit-code mapping — meaning fail-on-findings: false was ignored
and the action failed on any findings. (The pre-rewrite action had `set +e` here;
it was dropped during the Marketplace rewrite.)

- action.yml: `set +e` before the leakwatch call; the script maps 0/1/>=2 itself.
- action-test.yml (cli-github-format): `|| true` on the `out=$(leakwatch …)`
  capture so it doesn't abort under -e either.

Verified by reproducing GitHub's `bash -e -o pipefail`: without the fix the
mapping is skipped and the step exits 1; with it the mapping runs and the step
honors fail-on-findings. The run-action self-test (fail-on-findings: false) and
cli-github-format job are the regression guards.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@cemililik cemililik merged commit c8e476e into main May 25, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant