Skip to content

Commit a99389a

Browse files
authored
Update To latest Release and add Checkbox Option (fixes #274) (#279)
1 parent f613c4a commit a99389a

File tree

3 files changed

+27
-2
lines changed

3 files changed

+27
-2
lines changed

.github/workflows/test.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ jobs:
2525
- name: test explicit lychee version
2626
uses: ./
2727
with:
28+
checkbox: false # not supported in v0.15.1
2829
lycheeVersion: v0.15.1
2930

3031
- name: test nightly lychee version
@@ -286,6 +287,7 @@ jobs:
286287
- name: test explicit lychee version
287288
uses: ./
288289
with:
290+
checkbox: false # not supported in v0.15.1
289291
lycheeVersion: v0.15.1
290292

291293
- name: test nightly lychee version

action.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,16 @@ inputs:
2828
required: false
2929
lycheeVersion:
3030
description: "Use custom version of lychee link checker"
31-
default: v0.18.0
31+
default: v0.18.1
3232
required: false
3333
output:
3434
description: "Summary output file path"
3535
default: "lychee/out.md"
3636
required: false
37+
checkbox:
38+
description: "Add Markdown Styled Checkboxes to the output"
39+
default: true
40+
required: false
3741
token:
3842
description: "Your GitHub Access Token, defaults to: {{ github.token }}"
3943
default: ${{ github.token }}
@@ -117,6 +121,7 @@ runs:
117121
INPUT_FAILIFEMPTY: ${{ inputs.FAILIFEMPTY }}
118122
INPUT_FORMAT: ${{ inputs.FORMAT }}
119123
INPUT_JOBSUMMARY: ${{ inputs.JOBSUMMARY }}
124+
INPUT_CHECKBOX: ${{ inputs.CHECKBOX }}
120125
INPUT_OUTPUT: ${{ inputs.OUTPUT }}
121126
shell: bash
122127
branding:

entrypoint.sh

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,32 @@ FORMAT=""
2828
# If `format` occurs in args, ignore the value from `INPUT_FORMAT`
2929
[[ "$ARGS" =~ "--format " ]] || FORMAT="--format ${INPUT_FORMAT}"
3030

31+
3132
# If `output` occurs in args and `INPUT_OUTPUT` is set, exit with an error
3233
if [[ "$ARGS" =~ "--output " ]] && [ -n "${INPUT_OUTPUT:-}" ]; then
3334
echo "Error: 'output' is set in args as well as in the action configuration. Please remove one of them."
3435
exit 1
3536
fi
3637

38+
# If `--mode` occurs in args and `INPUT_CHECKBOX` is set, exit with an error
39+
# Use `--mode` instead of `--mode task` to ensure that the checkbox is not getting overwritten
40+
if [[ "$ARGS" =~ "--mode" ]] && [ -n "${INPUT_CHECKBOX:-}" ]; then
41+
echo "Error: '--mode' is set in args but 'checkbox' is set in the action configuration. Please remove one of them to avoid conflicts."
42+
exit 1
43+
fi
44+
45+
CHECKBOX=""
46+
if [ "${INPUT_CHECKBOX}" = true ]; then
47+
# Check if the version is higher than 0.18.1
48+
if [ "$(lychee --version | head -n1 | cut -d" " -f4)" -lt 0.18.1 ]; then
49+
echo "WARNING: 'checkbox' is not supported in lychee versions lower than 0.18.1. Continuing without 'checkbox'."
50+
else
51+
CHECKBOX="--mode task"
52+
fi
53+
fi
54+
3755
# Execute lychee
38-
eval lychee ${FORMAT} --output ${LYCHEE_TMP} ${ARGS}
56+
eval lychee ${CHECKBOX} ${FORMAT} --output ${LYCHEE_TMP} ${ARGS}
3957
LYCHEE_EXIT_CODE=$?
4058

4159
# If no links were found and `failIfEmpty` is set to `true` (and it is by default),

0 commit comments

Comments
 (0)