Skip to content

Commit

Permalink
Add debug argument
Browse files Browse the repository at this point in the history
  • Loading branch information
mre committed Aug 11, 2022
1 parent c2c86e5 commit 0aec091
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 6 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,7 @@ jobs:
format: doesnotexist # gets ignored if format set in args
output: /tmp/foo.txt
fail: true
- name: test debug
uses: ./
with:
debug: true
14 changes: 9 additions & 5 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ inputs:
description: "Lychee arguments (https://github.com/lycheeverse/lychee#commandline-parameters)"
default: "--verbose --no-progress './**/*.md' './**/*.html'"
required: false
debug:
description: "Enable debug output in action (set -x). Helpful for troubleshooting."
default: false
required: false
fail:
description: "Fail entire pipeline on error (i.e. when lychee exit code is not 0)"
default: false
Expand Down Expand Up @@ -34,10 +38,9 @@ runs:
steps:
- 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'
curl -sLO '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
install lychee /usr/local/bin/lychee
shell: bash
- name: Run lychee
run: ${{ github.action_path }}/entrypoint.sh
Expand All @@ -46,10 +49,11 @@ runs:
# 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_DEBUG: ${{ inputs.DEBUG }}
INPUT_FAIL: ${{ inputs.FAIL }}
INPUT_FORMAT: ${{ inputs.FORMAT }}
INPUT_JOBSUMMARY: ${{ inputs.JOBSUMMARY }}
INPUT_OUTPUT: ${{ inputs.OUTPUT }}
shell: bash
branding:
icon: "external-link"
Expand Down
8 changes: 7 additions & 1 deletion entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
#!/bin/bash -l
set -uxo pipefail
set -uo pipefail

# Enable optional debug output
if [ "${INPUT_DEBUG}" = true ]; then
echo "Debug output enabled"
set -x
fi

LYCHEE_TMP="/tmp/lychee/out.md"
GITHUB_WORKFLOW_URL="https://github.com/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}?check_suite_focus=true"
Expand Down

0 comments on commit 0aec091

Please sign in to comment.