Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add exitCode to action output #94

Closed

Conversation

rolandsusans
Copy link

expose grype exitCode to action output

Signed-off-by: Rolands Usans <rolands.usans@gmail.com>
@alfredodeza
Copy link
Contributor

Thanks for contributing a PR for this @rolandsusans ! Would you mind helping me understand in what context the exit code would be useful to report?

@njimenezotto
Copy link

Hi,
Thanks for your work.
The exit code will be very useful to run under the same job different security tools and only fail the workflow at the end if any of the tools ended in failure.

@luhring
Copy link
Contributor

luhring commented Aug 11, 2021

Hi @njimenezotto — I want to make sure I understand. A failure in any step should trigger a failure of the job. What would be the value added by exposing the exit code? A specific example would be helpful if you have one!

@operatorequals
Copy link

The Exit code can be checked adhoc (at any step of the workflow - e.g. the last).

@kzantow
Copy link
Contributor

kzantow commented Oct 5, 2021

Hi, I think this can be accomplished using the GitHub continue-on-error property. E.g you could set up a workflow like this:

- uses: anchore/scan-action@v3
  id: scan
  continue-on-error: true
  ...
- run: exit 1
  if: ${{steps.scan.outcome == 'failure'}}

See the step object: https://docs.github.com/en/actions/learn-github-actions/contexts#steps-context

And an example here:
https://github.com/kzantow-anchore/sbom-action-test/blob/scan-test/.github/workflows/scan-test.yml

And the failing run:
https://github.com/kzantow-anchore/sbom-action-test/runs/3805645839?check_suite_focus=true

I'll add an issue to update the documentation with an example like this, but going to close this PR because I think it is not needed -- feel free to reopen if I have misunderstood the use case!

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.

6 participants