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

Action exit code is not set #20

Closed
lenisha opened this issue Mar 15, 2021 · 6 comments
Closed

Action exit code is not set #20

lenisha opened this issue Mar 15, 2021 · 6 comments

Comments

@lenisha
Copy link

lenisha commented Mar 15, 2021

Th Lychee action exit code is not reflected in the job

Example run:
https://github.com/lenisha/linkchecker-test/runs/2117110939?check_suite_focus=true

    steps:
      - uses: actions/checkout@v2
      - name: lychee Link Checker
        id: lychee
        uses: lycheeverse/lychee-action@v1.0.4
        with:
          args: --exclude="^(javascript|chrome):.*"   --accept=200,403,429 "**/*.md" "**/*.html"
        env:
          GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
      - name: Fail if there were link errors
        run: exit ${{ steps.lychee.outputs.exit_code }}

Although Lychee step exits with status code 2, next steps does not get the exit code properly, it gets 0 instead of 2:

+ lychee '--exclude=^(javascript|chrome):.*' --accept=200,403,429 '**/*.md' '**/*.html' --output /tmp/lychee/out.md
+ exit_code=2
+ '[' 2 -ne 0 ']'
++ dirname lychee/out.md
+ mkdir -p lychee
+ echo 'Errors were reported while checking the availability of links:'
+ cat /tmp/lychee/out.md
+ cat /tmp/lychee/out.md
+ echo ::set-output name=exit_code::2
📝 Summary
---------------------
🔍 Total..........519
✅ Successful.....462
⏳ Timeouts.........0
🔀 Redirected.......0
👻 Excluded........53
🚫 Errors...........4

Errors in python/auto_examples/plot_train_convert_predict.html
✗ https://scikit-learn.org/stable/modules/preprocessing.html/nPlease [404 Not Found]

Errors in docs/reference/execution-providers/Nuphar-ExecutionProvider.md
✗ https://support.microsoft.com/en-us/help/841290 [404 Not Found]

Errors in docs/how-to/build.md
✗ https://cmake.org/files/v3.13/cmake-3.16.1.tar.gz [404 Not Found]
✗ https://www.raspberrypi.org/downloads/raspbian/ [404 Not Found]::set-output name=exit_code::2
1s
Run exit 
  exit 
  shell: /usr/bin/bash -e {0}
@mre
Copy link
Member

mre commented Mar 15, 2021

That's weird. You seem to have done everything correctly... 🤔

@mre
Copy link
Member

mre commented Mar 15, 2021

Tested locally and indeed lychee is exiting with status code 2.

@mre
Copy link
Member

mre commented Mar 15, 2021

Could be something Github actions related maybe? Was there a change recently on how error codes get propagated?

@mre
Copy link
Member

mre commented Mar 16, 2021

The only suspicious thing is that ::set-output didn't begin on a newline.
We recently removed extraneous newlines at the end of the status output, which might be the culprit.
(See lycheeverse/lychee#178)
Added an echo now for a test. Can you try lycheeverse/lychee-action@master and report back?

fyi @pawroman

@lenisha
Copy link
Author

lenisha commented Mar 16, 2021

@mre
Copy link
Member

mre commented Mar 16, 2021

🎉 thanks for the feedback

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

No branches or pull requests

2 participants