From 617a7b8705790573b6f53908e86e0d5eecc0924e Mon Sep 17 00:00:00 2001 From: Sebastiaan Speck <12570668+sebastiaanspeck@users.noreply.github.com> Date: Thu, 26 Sep 2024 09:42:37 +0200 Subject: [PATCH 1/5] Set exit_code correctly as output --- entrypoint.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/entrypoint.sh b/entrypoint.sh index deebb9c..f9413a1 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -69,6 +69,7 @@ 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 From cd96ce0bf3e70075cef4113c0d7845e255610737 Mon Sep 17 00:00:00 2001 From: Sebastiaan Speck <12570668+sebastiaanspeck@users.noreply.github.com> Date: Sat, 28 Sep 2024 03:10:14 +0200 Subject: [PATCH 2/5] Update test.yml --- .github/workflows/test.yml | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 5661365..0032fb1 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -194,3 +194,29 @@ jobs: uses: ./ with: token: ${{ secrets.CUSTOM_TOKEN }} + + - name: Test exit code set in steps-output and as env "lychee_exit_code" + id: lychee_exit_code_test + uses: ./ + + - 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 }}" == "0" ]]; then + echo "Lychee correctly failed with exit code 0" + else + echo "Unexpected exit code: ${{ steps.lychee_exit_code_test.outputs.exit_code }}" + echo "Expected exit code 0" + exit 1 + fi + + - name: Check exit code set as env "lychee_exit_code" + run: | + echo "Lychee exit code: ${{ env.lychee_exit_code }} & $lychee_exit_code" + if [[ "${{ env.lychee_exit_code }}" == "0" ]]; then + echo "Lychee correctly failed with exit code 0" + else + echo "Unexpected exit code: ${{ env.lychee_exit_code }}" + echo "Expected exit code 0" + exit 1 + fi From 1fc34ff4b01cb90a0f8d043d32e876694b70179e Mon Sep 17 00:00:00 2001 From: Sebastiaan Speck <12570668+sebastiaanspeck@users.noreply.github.com> Date: Sun, 29 Sep 2024 05:03:04 +0200 Subject: [PATCH 3/5] Update test.yml --- .github/workflows/test.yml | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 0032fb1..761a378 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -209,14 +209,3 @@ jobs: echo "Expected exit code 0" exit 1 fi - - - name: Check exit code set as env "lychee_exit_code" - run: | - echo "Lychee exit code: ${{ env.lychee_exit_code }} & $lychee_exit_code" - if [[ "${{ env.lychee_exit_code }}" == "0" ]]; then - echo "Lychee correctly failed with exit code 0" - else - echo "Unexpected exit code: ${{ env.lychee_exit_code }}" - echo "Expected exit code 0" - exit 1 - fi From 60c318f0222704ed62501b6f13783da5a17080f0 Mon Sep 17 00:00:00 2001 From: Sebastiaan Speck <12570668+sebastiaanspeck@users.noreply.github.com> Date: Sun, 29 Sep 2024 05:03:43 +0200 Subject: [PATCH 4/5] Update entrypoint.sh --- entrypoint.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/entrypoint.sh b/entrypoint.sh index f9413a1..ba2a65c 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -68,7 +68,6 @@ 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 From 36ce7a15874f70d06662cdf683bf32d999f4f834 Mon Sep 17 00:00:00 2001 From: Sebastiaan Speck <12570668+sebastiaanspeck@users.noreply.github.com> Date: Sun, 29 Sep 2024 11:45:14 +0200 Subject: [PATCH 5/5] Update test.yml --- .github/workflows/test.yml | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 761a378..bd411a6 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -195,17 +195,20 @@ jobs: with: token: ${{ secrets.CUSTOM_TOKEN }} - - name: Test exit code set in steps-output and as env "lychee_exit_code" + - 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 }}" == "0" ]]; then - echo "Lychee correctly failed with exit code 0" + 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 0" + echo "Expected exit code 1" exit 1 fi