Skip to content

Commit

Permalink
Add layer
Browse files Browse the repository at this point in the history
  • Loading branch information
jsoref committed Mar 6, 2024
1 parent 1df2826 commit a878f6e
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 5 deletions.
6 changes: 1 addition & 5 deletions .github/workflows/maybe-fail.yml
Expand Up @@ -21,7 +21,7 @@ jobs:
- uses: actions/checkout@v4
- name: Use maybe-fail action
id: maybe-fail
uses: ./maybe-fail
uses: ./call-maybe-fail
with:
return-code: ${{ matrix.return-code }}
continue-on-error: ${{ matrix.continue-on-error }}
Expand All @@ -38,10 +38,6 @@ jobs:
echo "result: $result"
echo
) | tee -a "$GITHUB_STEP_SUMMARY"
- name: If action failed
if: failure() && steps.maybe-fail.outcome == 'failure'
run: |
echo 'Something must be done because maybe-fail failed!' | tee -a "$GITHUB_STEP_SUMMARY"
- name: Next Step
run:
echo Next step | tee -a "$GITHUB_STEP_SUMMARY"
Expand Down
29 changes: 29 additions & 0 deletions use-maybe-fail/action.yml
@@ -0,0 +1,29 @@
name: 'Use maybe fail'
description: 'Call maybe fail to conditionally fail based on inputs'
inputs:
return-code:
description: 'Value to use as exit code for main step'
required: false
default: '0'
continue-on-error:
description: 'Whether to run the main step with `continue-on-error`'
required: false
default: 'false'
outputs:
result:
description: "Result for posterity"
value: ${{ steps.maybe-fail.outputs.result }}
runs:
using: "composite"
steps:
- name: Call maybe fail
id: maybe-fail
uses: ../maybe-fail
with:
return-code: ${{ inputs.return-code }}
continue-on-error: ${{ inputs.continue-on-error }}
- id: report-outcome
if: (success() || failure()) && steps.maybe-fail.outcome == 'failed'
run: |
echo 'Something must be done because maybe-fail failed!' | tee -a "$GITHUB_STEP_SUMMARY"
shell: bash

0 comments on commit a878f6e

Please sign in to comment.