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

Add debug argument #160

Merged
merged 1 commit into from
Aug 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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
17 changes: 9 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,14 +84,15 @@ lychee arguments can be passed to the action via the `args` parameter.

On top of that, the action also supports some additional arguments.

| Argument | Examples | Description |
| ------------- | ----------------------- |-------------------------------------------------------------------------------- |
| args | `--cache`, `--insecure` | See [lychee's documentation][lychee-args] for all arguments and values |
| format | `markdown`, `json` | Summary output format |
| output | `lychee/results.md` | Summary output file path |
| fail | `false` | Fail workflow run on error (i.e. when [lychee exit code][lychee-exit] is not 0) |
| jobSummary | `false` | Write Github job summary (on Markdown output only) |
| lycheeVersion | `0.10.1` | Overwrite the lychee version to be used |
| Argument | Examples | Description |
| ------------- | ----------------------- |--------------------------------------------------------------------------------- |
| args | `--cache`, `--insecure` | See [lychee's documentation][lychee-args] for all arguments and values. |
| debug | `false` | Enable debug output in action (set -x). Helpful for troubleshooting. |
| fail | `false` | Fail workflow run on error (i.e. when [lychee exit code][lychee-exit] is not 0). |
| format | `markdown`, `json` | Summary output format. |
| jobSummary | `false` | Write Github job summary (on Markdown output only). |
| lycheeVersion | `0.10.1` | Overwrite the lychee version to be used. |
| output | `lychee/results.md` | Summary output file path. |

See [action.yml](./action.yml) for a full list of supported arguments and their default values.

Expand Down
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