Repository navigation
51 lines (45 loc) · 1.8 KB
/
Copy pathlinks.yml
File metadata and controls
51 lines (45 loc) · 1.8 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
48
49
50
51
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
timeout-minutes: 30
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Setup Node
uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
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"
# Only the bot's own issue: anyone can open one with this label and title.
existing=$(gh issue list --limit 1000 --state open --label correction --json number,title,author \
--jq '[.[] | select(.author.login == "app/github-actions" and (.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