E589 Revert to old version of "failIfEmpty" check · lycheeverse/lychee-action@eb1a7d3 · GitHub
[go: up one dir, main page]

Skip to content

Commit eb1a7d3

Browse files
committed
Revert to old version of "failIfEmpty" check
1 parent 4b478a1 commit eb1a7d3

File tree

2 files changed

+14
-26
lines changed

2 files changed

+14
-26
lines changed

action.yml

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,26 +7,16 @@ inputs:
77
required: false
88
debug:
99
description: "Enable debug output in action (set -x). Helpful for troubleshooting."
10-
format:
11-
description: "output format (e.g. json)"
12-
default: "markdown"
13-
required: false
14-
output:
15-
description: "output file"
16-
default: "lychee/out.md"
10+
default: false
1711
required: false
18-
failIfEmpty:
19-
description: "fail entire pipeline if no links were found"
20-
default: true
12+
fail:
13+
description: "Fail entire pipeline on error (i.e. when lychee exit code is not 0)"
14+
default: false
2115
required: false
2216
failIfEmpty:
2317
description: "fail entire pipeline if no links were found"
2418
default: true
2519
required: false
26-
fail:
27-
description: "Fail entire pipeline on error (i.e. when lychee exit code is not 0)"
28-
default: false
29-
required: false
3020
format:
3121
description: "Summary output format (e.g. json)"
3222
default: "markdown"
@@ -80,4 +70,4 @@ runs:
8070
shell: bash
8171
branding:
8272
icon: "external-link"
83-
color: "purple"
73+
color: "purple"

entrypoint.sh

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
set -uo pipefail
33

44
# Enable optional debug output
5-
if [ "${INPUT_DEBUG}" = "true" ]; then
5+
if [ "${INPUT_DEBUG}" = true ]; then
66
echo "Debug output enabled"
77
set -x
88
fi
@@ -25,11 +25,7 @@ FORMAT=""
2525
eval lychee ${FORMAT} --output ${LYCHEE_TMP} ${ARGS}
2626
exit_code=$?
2727

28-
if [ ! -f "${LYCHEE_TMP}" ]; then
29-
echo "No output. Check pipeline run to see if lychee panicked." > "${LYCHEE_TMP}"
30-
fi
31-
32-
# Overwrite the error code in case no links were found
28+
# Overwrite the exit code in case no links were found
3329
# and `fail-if-empty` is set to `true` (and it is by default)
3430
if [ "${INPUT_FAILIFEMPTY:-false}" = "true" ]; then
3531
# This is a somewhat crude way to check the Markdown output of lychee
@@ -40,8 +36,10 @@ if [ "${INPUT_FAILIFEMPTY:-false}" = "true" ]; then
4036
fi
4137
fi
4238

43-
# If link errors were found, create a report in the designated directory
44-
if [ $exit_code -ne 0 ]; then
39+
if [ ! -f "${LYCHEE_TMP}" ]; then
40+
echo "No output. Check pipeline run to see if lychee panicked." > "${LYCHEE_TMP}"
41+
else
42+
# If we have any output, create a report in the designated directory
4543
mkdir -p "$(dirname -- "${INPUT_OUTPUT}")"
4644
cat "${LYCHEE_TMP}" > "${INPUT_OUTPUT}"
4745

@@ -55,16 +53,16 @@ cat "${LYCHEE_TMP}"
5553
echo
5654

5755
if [ "${INPUT_FORMAT}" == "markdown" ]; then
58-
if [ "${INPUT_JOBSUMMARY}" = "true" ]; then
56+
if [ "${INPUT_JOBSUMMARY}" = true ]; then
5957
cat "${LYCHEE_TMP}" > "${GITHUB_STEP_SUMMARY}"
6058
fi
6159
fi
6260

6361
# Pass lychee exit code to next step
64-
echo "lychee_exit_code=$exit_code" >> "$GITHUB_ENV"
62+
echo "lychee_exit_code=$exit_code" >> $GITHUB_ENV
6563

6664
# If `fail` is set to `true`, propagate the real exit code to the workflow
6765
# runner. This will cause the pipeline to fail on `exit != 0`.
68-
if [ "${INPUT_FAIL}" = "true" ]; then
66+
if [ "$INPUT_FAIL" = true ] ; then
6967
exit ${exit_code}
7068
fi

0 commit comments

Comments
 (0)
0