@@ -2,7 +2,7 @@ name: Daily Broken Link Check
22
33on :
44 schedule :
5- - cron : ' 0 2 * * *' # Every day at 2:00 AM UTC
5+ - cron : ' 0 2 * * *'
66 workflow_dispatch :
77
88jobs :
@@ -36,19 +36,19 @@ jobs:
3636 echo "has_issues=false" >> $GITHUB_OUTPUT
3737 fi
3838
39- - name : Find existing issue
40- id : find_issue
41- if : steps.check_file.outputs.has_issues == 'true'
42- uses : peter-evans/find-issue@v2
43- with :
44- title : " Broken Links Detected"
45- state : open
46-
4739 - name : Create or update GitHub Issue
4840 if : steps.check_file.outputs.has_issues == 'true'
49- uses : peter-evans/create-issue-from-file@v4
50- with :
51- title : " Broken Links Detected"
52- content-filepath : lychee/out.md
53- labels : bug, links
54- issue-number : ${{ steps.find_issue.outputs.issue-number }}
41+ env :
42+ GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
43+ run : |
44+ ISSUE_TITLE="🚨 Broken Links Detected"
45+ ISSUE_BODY="$(cat lychee/out.md)"
46+ EXISTING_ISSUE=$(gh issue list --state open --search "$ISSUE_TITLE" --json number,title | jq -r '.[] | select(.title == "'"$ISSUE_TITLE"'") | .number')
47+
48+ if [ -n "$EXISTING_ISSUE" ]; then
49+ echo "Updating existing issue #$EXISTING_ISSUE"
50+ gh issue edit "$EXISTING_ISSUE" --body "$ISSUE_BODY"
51+ else
52+ echo "Creating new issue"
53+ gh issue create --title "$ISSUE_TITLE" --body "$ISSUE_BODY" --label "bug,links"
54+ fi
0 commit comments