Check links on CF conventions web page #15
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# GitHub Actions Workflow to check links on CF website artifact, and reopen related issue | |
# | |
# For more information on the actions used in this workflow, please see: | |
# https://github.com/lycheeverse/lychee-action | |
# https://github.com/actions/download-artifact | |
# https://github.com/micalevisk/last-issue-action | |
# https://github.com/peter-evans/create-issue-from-file | |
# https://github.com/marketplace/actions/create-or-update-comment | |
name: Check links on CF conventions web page | |
on: | |
schedule: | |
- cron: '23 8 * * 1' | |
workflow_dispatch: | |
jobs: | |
check_links: | |
name: Check links # TODO: Check also Asciidoc (this should take place in https://github.com/cf-convention/cf-conventions) | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Build with Jekyll | |
uses: actions/jekyll-build-pages@v1 | |
- name: Check CF site's links | |
id: check-links | |
uses: lycheeverse/lychee-action@v1 | |
continue-on-error: true | |
with: | |
fail: true | |
format: markdown | |
jobSummary: true | |
output: .lychee/results.md | |
args: --config .lychee/config.toml ./_site/ | |
env: | |
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 | |
id: last-issue | |
uses: micalevisk/last-issue-action@v2 | |
with: | |
state: all | |
# Find the last updated open issue that has these labels: | |
labels: | | |
defect, link-checker, report, automated issue | |
- name: If failure and issue not found, create issue | |
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" | |
content-filepath: .lychee/results.md | |
token: ${{ secrets.GITHUB_TOKEN }} | |
labels: | | |
defect, link-checker, report, automated issue | |
- name: If failure and issue exists, add comment | |
if: ${{ 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 }} | |