From 710fe3b6adfb23bce0715a7c725f6c933a427bb7 Mon Sep 17 00:00:00 2001 From: David Stancel Date: Mon, 16 Mar 2026 19:11:18 +0800 Subject: [PATCH] Fix GITHUB_OUTPUT format error in link checker grep -c returns exit 1 on no matches, causing `|| echo "0"` to append a bare "0" line to GITHUB_OUTPUT. Use `|| true` instead and default BROKEN to 0. Co-Authored-By: Claude Opus 4.6 (1M context) --- .github/workflows/link-checker.yml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/.github/workflows/link-checker.yml b/.github/workflows/link-checker.yml index ee9b878..e6e6657 100644 --- a/.github/workflows/link-checker.yml +++ b/.github/workflows/link-checker.yml @@ -26,7 +26,6 @@ jobs: --accept 200,204,206,301,302,307,308,403 --timeout 30 --max-retries 3 - --exclude 'tornadocash.eth.link' --exclude 'localhost' --exclude '127.0.0.1' @@ -36,12 +35,12 @@ jobs: - name: Read lychee output id: results run: | + BROKEN=0 if [ -f ./lychee/out.md ]; then - BROKEN=$(grep -c '\[ERR\]\|❌\|✗' ./lychee/out.md 2>/dev/null || echo "0") - echo "broken_count=$BROKEN" >> $GITHUB_OUTPUT - else - echo "broken_count=0" >> $GITHUB_OUTPUT + BROKEN=$(grep -c '\[ERR\]\|❌\|✗' ./lychee/out.md 2>/dev/null || true) + [ -z "$BROKEN" ] && BROKEN=0 fi + echo "broken_count=$BROKEN" >> $GITHUB_OUTPUT - name: Create issue for broken links if: steps.results.outputs.broken_count != '0'