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

Conversation

sebastiaanspeck
Copy link
Contributor

Fixes #244

@mre
Copy link
Member

mre commented Sep 27, 2024

Thanks! Can you also add a test which checks that the exit code works to https://github.com/lycheeverse/lychee-action/blob/master/.github/workflows/test.yml?

Something like that:

      - name: Test exit code output (expecting failure)
        id: lychee_exit_test
        uses: ./
        with:
          args: -- inputdoesnotexist
        continue-on-error: true

      - name: Check exit code
        run: |
          echo "Lychee exit code: ${{ steps.lychee_exit_test.outputs.exit_code }}"
          if [[ "${{ steps.lychee_exit_test.outputs.exit_code }}" == "1" ]]; then
            echo "Lychee correctly failed with exit code 1"
          else
            echo "Unexpected exit code: ${{ steps.lychee_exit_test.outputs.exit_code }}"
            echo "Expected exit code 1 for failed check"
            exit 1
          fi

@mre
Copy link
Member

mre commented Sep 29, 2024

I think we need to test if lychee failed with an exit code other than 0 in case of error. Right now you're testing for 0, which is the default and should always work because otherwise the GitHub workflow stops. Did you try the code snippet I posted? 🤔

Copy link
Member

@mre mre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm thanks!

@mre mre merged commit 22c8e46 into lycheeverse:master Sep 29, 2024
3 checks passed
@kdeldycke kdeldycke mentioned this pull request Oct 9, 2024
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.

${{ steps.lychee.outputs.exit_code }} is not set correctly
2 participants