Skip to content

Commit

Permalink
Improve check links cron workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
cofinoa committed May 27, 2024
1 parent c290b52 commit 2eca3d9
Showing 1 changed file with 16 additions and 8 deletions.
24 changes: 16 additions & 8 deletions .github/workflows/check_links_cron.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ jobs:
- name: Check CF site's links
id: check-links
uses: lycheeverse/lychee-action@v1
continue-on-error: true
with:
fail: true
format: markdown
Expand All @@ -40,17 +41,16 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # GitHub API token to use when checking github.com links, to avoid rate limiting

- name: Find the last report issue
if: ${{ always() }}
id: last-issue
uses: micalevisk/last-issue-action@v2
with:
state: open
state: all
# Find the last updated open issue that has these labels:
labels: |
defect, link-checker, report, automated issue
defect, link-checker, report, automated issue
- name: On failure create issue if missing
if: ${{ failure() && steps.last-issue.outputs.has-found == 'false' }}
- name: If failure, create issue if missing
if: ${{ steps.check-links.outcome == 'failure' && steps.last-issue.outputs.has-found == false }}
uses: peter-evans/create-issue-from-file@v5
with:
title: "Broken links detected in CF Website"
Expand All @@ -59,12 +59,20 @@ jobs:
labels: |
defect, link-checker, report, automated issue
- name: On failure add comment to issue if exist
if: ${{ always() && steps.last-issue.outputs.has-found == 'true' }}
- name: If failure and issue exists, add comment
if: ${{ failure() && steps.check-links.outcome == 'failure' && steps.last-issue.outputs.has-found == true }}
uses: peter-evans/create-or-update-comment@v4
with:
issue-number: ${{ steps.last-issue.outputs.issue-number }}
body-path: .lychee/results.md
token: ${{ secrets.GITHUB_TOKEN }}


- name: If success and issue is open, add comment
if: ${{ steps.check-links.outcome == 'success' && steps.last-issue.outputs.is-closed == false }}
uses: peter-evans/create-or-update-comment@v4
with:
issue-number: ${{ steps.last-issue.outputs.issue-number }}
body-path: .lychee/results.md
token: ${{ secrets.GITHUB_TOKEN }}


0 comments on commit 2eca3d9

Please sign in to comment.