Skip to content

Commit a4069cb

Browse files
Jammy2211claude
authored andcommitted
ci: add live URL audit (weekly cron) + grandfather current broken URLs
Add .url_check_allowlist.txt at repo root containing the 0 broken URLs the audit currently flags in PyAutoArray — mostly external paywalled / dead links and a few internal docs renames that need editorial fixes. The weekly cron job will only fail when a NEW broken URL appears that isn't in this file. Update .github/workflows/url_check.yml: - keep the existing offline regex guard (runs on every PR + push, now with ~15 additional bad patterns thanks to the matching PyAutoBuild extension) - add a url_check_live job that runs on schedule (Mon 04:00 UTC) and workflow_dispatch. On non-zero exit it opens or comments on a [url-check] New broken URLs detected tracking issue. - on a clean run, auto-closes any prior open [url-check] issue. Tool: PyAutoLabs/PyAutoBuild#87 (paired PR — must merge first for the extended regex patterns and the new live tool to be available). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent f14097d commit a4069cb

2 files changed

Lines changed: 98 additions & 0 deletions

File tree

.github/workflows/url_check.yml

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
name: URL Check
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
schedule:
8+
- cron: '0 4 * * 1' # Mondays 04:00 UTC
9+
workflow_dispatch:
10+
11+
permissions:
12+
contents: read
13+
14+
jobs:
15+
url_check_patterns:
16+
name: Offline regex guard
17+
runs-on: ubuntu-latest
18+
steps:
19+
- name: Checkout repo
20+
uses: actions/checkout@v4
21+
with:
22+
path: repo
23+
- name: Checkout PyAutoBuild
24+
uses: actions/checkout@v4
25+
with:
26+
repository: PyAutoLabs/PyAutoBuild
27+
ref: main
28+
path: PyAutoBuild
29+
- name: Run url_check.sh
30+
run: bash PyAutoBuild/autobuild/url_check.sh repo
31+
32+
url_check_live:
33+
name: Live HTTP audit (weekly)
34+
if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
35+
runs-on: ubuntu-latest
36+
permissions:
37+
contents: read
38+
issues: write
39+
steps:
40+
- name: Checkout repo
41+
uses: actions/checkout@v4
42+
with:
43+
path: repo
44+
- name: Checkout PyAutoBuild
45+
uses: actions/checkout@v4
46+
with:
47+
repository: PyAutoLabs/PyAutoBuild
48+
ref: main
49+
path: PyAutoBuild
50+
- name: Set up Python
51+
uses: actions/setup-python@v5
52+
with:
53+
python-version: '3.12'
54+
- name: Install requests
55+
run: pip install --quiet requests
56+
- name: Run live URL audit
57+
id: audit
58+
run: |
59+
set +e
60+
body=$(bash PyAutoBuild/autobuild/url_check_live.sh repo)
61+
rc=$?
62+
printf '%s\n' "$body" > /tmp/url_audit_body.md
63+
echo "rc=$rc" >> "$GITHUB_OUTPUT"
64+
cat /tmp/url_audit_body.md
65+
exit 0
66+
- name: Open or update [url-check] tracking issue
67+
if: steps.audit.outputs.rc != '0'
68+
env:
69+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
70+
run: |
71+
cd repo
72+
existing=$(gh issue list --search '"[url-check]"' --state open --json number --jq '.[0].number // empty')
73+
if [ -n "$existing" ]; then
74+
echo "Updating existing tracking issue #$existing"
75+
gh issue comment "$existing" --body-file /tmp/url_audit_body.md
76+
else
77+
echo "Opening new tracking issue"
78+
gh issue create \
79+
--title "[url-check] New broken URLs detected" \
80+
--body-file /tmp/url_audit_body.md \
81+
--label url-check 2>/dev/null \
82+
|| gh issue create \
83+
--title "[url-check] New broken URLs detected" \
84+
--body-file /tmp/url_audit_body.md
85+
fi
86+
- name: Close stale tracking issue if audit is clean
87+
if: steps.audit.outputs.rc == '0'
88+
env:
89+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
90+
run: |
91+
cd repo
92+
for n in $(gh issue list --search '"[url-check]"' --state open --json number --jq '.[].number'); do
93+
echo "Closing now-clean tracking issue #$n"
94+
gh issue close "$n" --comment "Weekly URL audit is clean — closing automatically."
95+
done

.url_check_allowlist.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Known broken URLs grandfathered for url_check_live.sh.
2+
# Add a URL on its own line to ignore it. Comments start with '#'.
3+
# Currently no broken URLs in this repo's docs.

0 commit comments

Comments
 (0)