Links #762
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
name: Links | |
on: | |
repository_dispatch: | |
workflow_dispatch: | |
schedule: | |
- cron: "00 18 * * *" | |
jobs: | |
linkChecker: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
ref: "gh-pages" | |
- name: Link Checker | |
id: lychee | |
uses: lycheeverse/[email protected] | |
with: | |
args: --verbose --no-progress **/*.html | |
env: | |
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} | |
- name: Lychee's exit code | |
## https://github.com/lycheeverse/lychee#exit-codes | |
run: echo Lychee exit with ${{ steps.lychee.outputs.exit_code }} | |
- name: Find the last open report issue | |
id: last_issue | |
uses: micalevisk/last-issue-action@v2 | |
with: | |
state: open | |
## The issue must have the following labels | |
labels: report, automated issue | |
env: | |
## Optional since it uses the `GITHUB_TOKEN` created by GitHub by default | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Create an issue from report file | |
if: >- | |
steps.last_issue.outputs.has_found == 'false' && | |
steps.lychee.outputs.exit_code != 0 | |
uses: peter-evans/create-issue-from-file@v4 | |
with: | |
title: Link checker report | |
content-filepath: /tmp/lychee/out.md | |
issue-number: ${{ steps.last_issue.outputs.issue_number }} | |
labels: report, automated issue | |
- run: echo ${{ steps.last_issue.outputs.issue_number }} | |
- name: Update last report open issue created | |
if: ${{ steps.last_issue.outputs.has_found == 'true' }} | |
uses: peter-evans/create-issue-from-file@v4 | |
with: | |
title: Link checker report | |
content-filepath: /tmp/lychee/out.md | |
issue-number: ${{ steps.last_issue.outputs.issue_number }} | |
labels: report, automated issue | |
- name: Close the last report open issue | |
if: >- | |
steps.last_issue.outputs.has_found == 'true' && | |
steps.lychee.outputs.exit_code == 0 | |
uses: peter-evans/close-issue@v2 | |
with: | |
issue-number: ${{ steps.last_issue.outputs.issue_number }} |