Skip to content

fix: handle empty scanner results and add fail-on-error input - #12

Merged
jmeridth merged 1 commit into
mainfrom
jm_summary_cleanup
Feb 24, 2026
Merged

jmeridth merged 1 commit into
mainfrom
jm_summary_cleanup

Conversation

@jmeridth

Copy link
Copy Markdown
Member

Relates to #10

What

Move control line parsing before markdown output so the step detects empty results early and displays a re-run message instead of failing. Add a fail-on-error input (default false) that exits 1 when the assessment has failed controls, giving users opt-in strict mode.

Why

The scanner occasionally completes without emitting control results. The previous grep piped directly into a while loop under set -e, causing the step to fail with exit code 1 on zero matches. The new fail-on-error flag lets users who want to gate merges on assessment results opt in without breaking existing workflows.

Notes

  • The || true on grep is critical — without it, any run where the scanner silently fails will also fail this step
  • fail-on-error defaults to false for backward compatibility; existing users see no behavior change
  • The FAILED count is parsed from the summary line in the parent shell scope, not inside the piped while-loop subshell, so it's accessible for the exit check
  • If the output of the summary gets any more complicated we will be switching from bash to actions/github-script to utilize
    • It gives you access to core.summary which has a builder API for markdown tables

Relates to #10

## What

Move control line parsing before markdown output so the step detects
empty results early and displays a re-run message instead of failing.
Add a fail-on-error input (default false) that exits 1 when the
assessment has failed controls, giving users opt-in strict mode.

## Why

The scanner occasionally completes without emitting control results.
The previous grep piped directly into a while loop under set -e,
causing the step to fail with exit code 1 on zero matches. The new
fail-on-error flag lets users who want to gate merges on assessment
results opt in without breaking existing workflows.

## Notes

- The || true on grep is critical — without it, any run where the scanner silently fails will also fail this step
- fail-on-error defaults to false for backward compatibility; existing users see no behavior change
- The FAILED count is parsed from the summary line in the parent shell scope, not inside the piped while-loop subshell, so it's accessible for the exit check

Signed-off-by: jmeridth <jmeridth@gmail.com>
@jmeridth jmeridth self-assigned this Feb 24, 2026
@jmeridth
jmeridth requested a review from a team as a code owner February 24, 2026 20:20
@github-actions github-actions Bot added the fix label Feb 24, 2026
@jmeridth
jmeridth merged commit 99e372d into main Feb 24, 2026
3 checks passed
@jmeridth
jmeridth deleted the jm_summary_cleanup branch February 24, 2026 20:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant