2022-09-07 15:31:38 +02:00
|
|
|
name: Check links
|
|
|
|
|
|
|
|
on:
|
|
|
|
workflow_dispatch:
|
2022-09-07 16:38:39 +02:00
|
|
|
schedule:
|
|
|
|
- cron: '30 12 * * 1-5'
|
2022-09-07 15:31:38 +02:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
validate:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
permissions:
|
|
|
|
contents: read
|
|
|
|
issues: write
|
|
|
|
env:
|
|
|
|
issue-lookup-label: automated-link-issue
|
|
|
|
issue-content: ./lychee-out.md
|
|
|
|
steps:
|
2023-10-05 10:19:57 +02:00
|
|
|
- uses: actions/checkout@v4
|
2022-09-07 15:31:38 +02:00
|
|
|
- name: Restore lychee cache
|
2024-01-18 08:28:53 +01:00
|
|
|
uses: actions/cache@v4
|
2022-09-07 15:31:38 +02:00
|
|
|
with:
|
|
|
|
path: .lycheecache
|
|
|
|
key: cache-lychee-${{ github.sha }}
|
|
|
|
restore-keys: cache-lychee-
|
|
|
|
- name: Link Checker
|
|
|
|
id: lychee
|
2024-06-06 02:33:36 +02:00
|
|
|
uses: lycheeverse/lychee-action@v1.10.0
|
2022-09-07 15:31:38 +02:00
|
|
|
with:
|
|
|
|
fail: true
|
|
|
|
args: '"./website/docs/**/*.md" "./website/docs/**/*.mdx" "./src/mailtemplates/*.mustache" --scheme http --scheme https --cache --max-cache-age 7d --exclude-mail --verbose' # other excludes are in .lycheeignore
|
|
|
|
output: ${{ env.issue-content }}
|
|
|
|
|
|
|
|
# Permissions (issues: read)
|
|
|
|
- name: 'Look for an existing issue'
|
|
|
|
if: ${{ failure() }}
|
|
|
|
id: last-issue
|
|
|
|
uses: micalevisk/last-issue-action@v2
|
|
|
|
# Find the last updated open issue with a `automated-issue` label:
|
|
|
|
with:
|
|
|
|
state: open
|
|
|
|
labels: ${{ env.issue-lookup-label }}
|
|
|
|
|
|
|
|
# Permissions (issues: write)
|
|
|
|
- name: 'Create a new issue, or update an existing one'
|
|
|
|
if: ${{ failure() }}
|
|
|
|
uses: peter-evans/create-issue-from-file@v4
|
|
|
|
with:
|
|
|
|
title: 'docs: Broken links found'
|
|
|
|
content-filepath: ${{ env.issue-content }}
|
|
|
|
# Update an existing issue if one was found (issue_number),
|
|
|
|
# otherwise an empty value creates a new issue:
|
|
|
|
issue-number: ${{ steps['last-issue']['outputs']['issue-number'] }}
|
|
|
|
# Add a label(s) that `last-issue` can use to find this issue,
|
|
|
|
# and any other relevant labels for the issue itself:
|
|
|
|
labels: |
|
|
|
|
${{ env.issue-lookup-label }}
|
|
|
|
docs
|