Skip to content

Commit

Permalink
Set exit_code correctly as output (#245)
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastiaanspeck authored Sep 29, 2024
1 parent 5047c2a commit 22c8e46
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
18 changes: 18 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -194,3 +194,21 @@ jobs:
uses: ./
with:
token: ${{ secrets.CUSTOM_TOKEN }}

- name: Test exit code set in steps-output
id: lychee_exit_code_test
uses: ./
with:
args: -- inputdoesnotexist
continue-on-error: true

- name: Check exit code in steps.outputs
run: |
echo "Lychee exit code: ${{ steps.lychee_exit_code_test.outputs.exit_code }}"
if [[ "${{ steps.lychee_exit_code_test.outputs.exit_code }}" == "1" ]]; then
echo "Lychee correctly failed with exit code 1"
else
echo "Unexpected exit code: ${{ steps.lychee_exit_code_test.outputs.exit_code }}"
echo "Expected exit code 1"
exit 1
fi
2 changes: 1 addition & 1 deletion entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ if [ "${INPUT_FORMAT}" == "markdown" ]; then
fi

# Pass lychee exit code to next step
echo "lychee_exit_code=$exit_code" >> $GITHUB_ENV
echo "exit_code=$exit_code" >> $GITHUB_OUTPUT

# If `fail` is set to `true` (and it is by default), propagate the real exit
# value to the workflow runner. This will cause the pipeline to fail on
Expand Down

0 comments on commit 22c8e46

Please sign in to comment.