Skip to content

Commit 7f22ea4

Browse files
New Updated File which creates/ updates existing Issue
1 parent ee411ea commit 7f22ea4

File tree

1 file changed

+16
-24
lines changed

1 file changed

+16
-24
lines changed

.github/workflows/check-broken-links.yml

Lines changed: 16 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ name: Daily Broken Link Check
22

33
on:
44
schedule:
5-
- cron: '0 0 * * *' # Daily at midnight UTC
5+
- cron: '0 2 * * *' # Every day at 2:00 AM UTC
66
workflow_dispatch:
77

88
jobs:
9-
link-check:
9+
broken-link-check:
1010
runs-on: ubuntu-latest
1111

1212
steps:
@@ -27,36 +27,28 @@ jobs:
2727
env:
2828
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2929

30-
- name: Check for broken links
31-
id: broken
30+
- name: Check if output file is empty
31+
id: check_file
3232
run: |
33-
if grep -q "✗" lychee/out.md; then
34-
echo "found=true" >> "$GITHUB_OUTPUT"
33+
if [ -s lychee/out.md ]; then
34+
echo "has_issues=true" >> $GITHUB_OUTPUT
3535
else
36-
echo "found=false" >> "$GITHUB_OUTPUT"
36+
echo "has_issues=false" >> $GITHUB_OUTPUT
3737
fi
3838
39-
- name: Find existing broken-link issue
40-
if: steps.broken.outputs.found == 'true'
41-
uses: micalevisk/last-issue-action@v2
39+
- name: Find existing issue
4240
id: find_issue
43-
with:
44-
state: open
45-
labels: broken-link-check
46-
47-
- name: Create new issue if no existing one
48-
if: steps.broken.outputs.found == 'true' && steps.find_issue.outputs.issue_number == ''
49-
uses: peter-evans/create-issue-from-file@v5
41+
if: steps.check_file.outputs.has_issues == 'true'
42+
uses: peter-evans/find-issue@v2
5043
with:
5144
title: "Broken Links Detected"
52-
content-filepath: lychee/out.md
53-
labels: broken-link-check
45+
state: open
5446

55-
- name: Update existing issue if found
56-
if: steps.broken.outputs.found == 'true' && steps.find_issue.outputs.issue_number != ''
57-
uses: peter-evans/create-issue-from-file@v5
47+
- name: Create or update GitHub Issue
48+
if: steps.check_file.outputs.has_issues == 'true'
49+
uses: peter-evans/create-issue-from-file@v4
5850
with:
5951
title: "Broken Links Detected"
6052
content-filepath: lychee/out.md
61-
labels: broken-link-check
62-
issue-number: ${{ steps.find_issue.outputs.issue_number }}
53+
labels: bug, links
54+
issue-number: ${{ steps.find_issue.outputs.issue-number }}

0 commit comments

Comments
 (0)