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

Set exit_code correctly as output #245

Merged
merged 5 commits into from
Sep 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading