-
Notifications
You must be signed in to change notification settings - Fork 0
64 lines (61 loc) · 2.61 KB
/
Copy pathlinks.yml
File metadata and controls
64 lines (61 loc) · 2.61 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
52
53
54
55
56
57
58
59
60
61
62
63
64
name: Links
on:
schedule:
- cron: "0 6 * * 1"
workflow_dispatch:
permissions:
contents: read
issues: write
jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Check links
id: lychee
uses: lycheeverse/lychee-action@v2
with:
# Checks github.com through the API instead of scraping it, which is what
# keeps 55 repo links off the anonymous rate limit.
token: ${{ secrets.GITHUB_TOKEN }}
# /stargazers is login-walled — it 404s for anonymous clients on every
# repo, ours and psf/requests alike. pepy download badges 404 by design
# until a listed package reaches PyPI (AGENTS.md), and test_profile.py
# already pins each badge to its repo name.
args: >-
--cache
--max-cache-age 1d
--no-progress
--exclude 'github\.com/.*/stargazers'
--exclude 'static\.pepy\.tech'
'**/*.md'
fail: false
# create-issue-from-file does not deduplicate — it calls issues.create
# unconditionally, so six weeks of one dead link is six identical issues. This is
# the same find-or-comment shape every repo's report-scheduled-failure.sh uses.
- name: Open or update the tracking issue
if: steps.lychee.outputs.exit_code != 0
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
run: |
set -euo pipefail
LABEL="broken-links"
gh label create "$LABEL" \
--color "D93F0B" \
--description "Weekly external link check failures" \
--force
# The report is what changes week to week, so each comment carries the current
# one; 30k keeps a long report inside GitHub's comment limit.
report=$(head -c 30000 lychee/out.md 2>/dev/null || echo "(no report file produced)")
existing=$(gh issue list --label "$LABEL" --state open --json number --jq '.[0].number // empty')
if [ -z "$existing" ]; then
gh issue create --title "Broken links found" --label "$LABEL" --body "$(printf '%s\n\n%s\n\n%s' \
"The weekly external link check failed. Close this issue once the links are fixed; the next failure opens a fresh one." \
"First failing run: ${RUN_URL}" \
"$report")"
else
gh issue comment "$existing" --body "$(printf '%s\n\n%s' \
"Still failing: ${RUN_URL}" \
"$report")"
fi