| 1 |
name: Links |
| 2 |
|
| 3 |
on: |
| 4 |
repository_dispatch: |
| 5 |
workflow_dispatch: |
| 6 |
schedule: |
| 7 |
# Everyday at 9:00 AM. |
| 8 |
- cron: "0 9 * * *" |
| 9 |
|
| 10 |
# Declare default permissions as read only. |
| 11 |
permissions: read-all |
| 12 |
|
| 13 |
jobs: |
| 14 |
check-links: |
| 15 |
runs-on: ubuntu-latest |
| 16 |
permissions: |
| 17 |
issues: write # required for creating issues from link checker reports |
| 18 |
steps: |
| 19 |
- name: Checkout Repo |
| 20 |
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 |
| 21 |
|
| 22 |
|
| 23 |
- name: Restore lychee cache |
| 24 |
uses: actions/cache/restore@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4 |
| 25 |
id: cache-restore |
| 26 |
with: |
| 27 |
path: .lycheecache |
| 28 |
key: cache-lychee-${{ github.sha }} |
| 29 |
restore-keys: cache-lychee- |
| 30 |
|
| 31 |
- name: Link Checker |
| 32 |
id: lychee |
| 33 |
uses: lycheeverse/lychee-action@8646ba30535128ac92d33dfc9133794bfdd9b411 # v2.8.0 |
| 34 |
env: |
| 35 |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 36 |
with: |
| 37 |
args: --max-concurrency 1 --cache --max-cache-age 1d --cache-exclude-status 300..=599 . |
| 38 |
|
| 39 |
- name: Save lychee cache |
| 40 |
if: always() |
| 41 |
uses: actions/cache/save@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4 |
| 42 |
with: |
| 43 |
path: .lycheecache |
| 44 |
key: ${{ steps.cache-restore.outputs.cache-primary-key }} |
| 45 |
|
| 46 |
- name: Create Issue From File |
| 47 |
if: steps.lychee.outputs.exit_code != 0 |
| 48 |
uses: peter-evans/create-issue-from-file@fca9117c27cdc29c6c4db3b86c48e4115a786710 # v6.0.0 |
| 49 |
with: |
| 50 |
title: Link Checker Report |
| 51 |
content-filepath: ./lychee/out.md |
| 52 |
labels: report, bot-generated |