Skip to content

Commit

Permalink
Propagate lychee exit code (#145)
Browse files Browse the repository at this point in the history
Ever since we moved to a composite action the exit code for lychee didn't work as expected.
The reason is that the the output of a step needs to be propagated to an output of the entire
action by setting an explicit parameter in the `outputs` section.
See https://docs.github.com/en/actions/creating-actions/metadata-syntax-for-github-actions#outputs-for-composite-actions
  • Loading branch information
mre authored Jul 12, 2022
1 parent a520e85 commit 72460ce
Showing 1 changed file with 15 additions and 10 deletions.
25 changes: 15 additions & 10 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,50 +2,55 @@ name: "Lychee Broken Link Checker"
description: "Quickly check links in Markdown, HTML, and text files"
inputs:
args:
description: "lychee arguments"
description: "Lychee arguments (https://github.com/lycheeverse/lychee#commandline-parameters)"
default: "--verbose --no-progress './**/*.md' './**/*.html'"
required: false
format:
description: "summary output format (e.g. json)"
description: "Summary output format (e.g. json)"
default: "markdown"
required: false
output:
description: "summary output file path"
description: "Summary output file path"
default: "lychee/out.md"
required: false
fail:
description: "fail entire pipeline on error (i.e. when lychee exit code is not 0)"
description: "Fail entire pipeline on error (i.e. when lychee exit code is not 0)"
default: false
required: false
jobSummary:
description: "write Github job summary at the end of the job (written on Markdown output only)"
description: "Write Github job summary at the end of the job (written on Markdown output only)"
default: true
required: false
lycheeVersion:
description: "use custom version of lychee link checker"
description: "Use custom version of lychee link checker"
default: 0.10.0
required: false
outputs:
exit_code:
description: "The exit code returned from Lychee"
value: ${{ steps.lychee.outputs.exit_code }}
runs:
using: "composite"
steps:
- name: install lychee
- name: Install lychee
run: |
curl -LO 'https://github.com/lycheeverse/lychee/releases/download/v${{ inputs.LYCHEEVERSION }}/lychee-v${{ inputs.LYCHEEVERSION }}-x86_64-unknown-linux-gnu.tar.gz'
tar -xvzf lychee-v${{ inputs.LYCHEEVERSION }}-x86_64-unknown-linux-gnu.tar.gz
chmod 755 lychee
mv lychee /usr/local/bin/lychee
shell: bash
- run: ${{ github.action_path }}/entrypoint.sh
- name: Run lychee
run: ${{ github.action_path }}/entrypoint.sh
id: lychee
env:
#https://github.com/actions/runner/issues/665
# https://github.com/actions/runner/issues/665
INPUT_GITHUB_TOKEN: ${{ inputs.GITHUB_TOKEN }}
INPUT_ARGS: ${{ inputs.ARGS }}
INPUT_FORMAT: ${{ inputs.FORMAT }}
INPUT_OUTPUT: ${{ inputs.OUTPUT }}
INPUT_FAIL: ${{ inputs.FAIL }}
INPUT_JOBSUMMARY: ${{ inputs.JOBSUMMARY }}
shell: bash

branding:
icon: "external-link"
color: "purple"

0 comments on commit 72460ce

Please sign in to comment.