-
Notifications
You must be signed in to change notification settings - Fork 6
47 lines (41 loc) · 1.49 KB
/
Copy pathlinks.yml
File metadata and controls
47 lines (41 loc) · 1.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
name: Check source links
# Weekly: fetch every entry's url, and open or update one issue listing dead
# links, sources that moved, and entries whose licence check is over a year
# old. It never edits an entry: each one needs its licence re-read first.
on:
schedule:
- cron: "41 7 * * 1"
workflow_dispatch:
permissions:
contents: read
issues: write
jobs:
links:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v7
- name: Setup Node
uses: actions/setup-node@v7
with:
node-version-file: .nvmrc
- name: Check links
id: check
env:
# Read-only use of the GitHub API for the archived / inactive check.
GITHUB_TOKEN: ${{ github.token }}
run: node site/check-links.mjs --report link-report.md
- name: Open or update the report issue
if: steps.check.outputs.problems != '0'
env:
GH_TOKEN: ${{ github.token }}
PROBLEMS: ${{ steps.check.outputs.problems }}
run: |
title="Link check: ${PROBLEMS} sources need a look"
existing=$(gh issue list --state open --label correction --json number,title \
--jq '[.[] | select(.title | startswith("Link check:"))][0].number // empty')
if [ -n "$existing" ]; then
gh issue edit "$existing" --title "$title" --body-file link-report.md
else
gh issue create --title "$title" --label correction --body-file link-report.md
fi