Skip to content

Commit f705c8a

Browse files
clubandersonclaude
andcommitted
✨ Add GitHub Agentic Workflows for typo, link, and upstream checks
Replace legacy CI callers with AI-powered gh-aw workflows: - typo-checker.md: domain-aware typo checking on PR changed files - link-checker.md: smart link checking with transient failure handling - upstream-monitor.md: daily scan for upstream breaking changes - copilot-setup-steps.yml: installs gh-aw CLI extension - .gitattributes: marks lock files as generated - docs/upstream-versions.md: template for tracking dependency pins Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> Signed-off-by: Andrew Anderson <andy@clubanderson.com>
1 parent 4075653 commit f705c8a

File tree

9 files changed

+24726
-0
lines changed

9 files changed

+24726
-0
lines changed

.gitattributes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
.github/workflows/*.lock.yml linguist-generated=true merge=ours
2+
.github/workflows/*.campaign.g.md linguist-generated=true merge=ours
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: "Copilot Setup Steps"
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
paths:
7+
- .github/workflows/copilot-setup-steps.yml
8+
9+
jobs:
10+
copilot-setup-steps:
11+
runs-on: ubuntu-latest
12+
permissions:
13+
contents: read
14+
steps:
15+
- name: Install gh-aw extension
16+
run: |
17+
curl -fsSL https://raw.githubusercontent.com/githubnext/gh-aw/refs/heads/main/install-gh-aw.sh | bash
18+
19+
- name: Verify gh-aw installation
20+
run: gh aw version

.github/workflows/link-checker.lock.yml

Lines changed: 8453 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.github/workflows/link-checker.md

Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
---
2+
description: |
3+
AI-powered link checker for pull requests. Checks only changed markdown files,
4+
distinguishes real broken links from transient failures, and posts actionable
5+
PR comments instead of failing CI on flaky external URLs.
6+
7+
on:
8+
pull_request:
9+
paths:
10+
- "**/*.md"
11+
12+
permissions: read-all
13+
14+
network:
15+
allowed:
16+
- defaults
17+
- "*.github.com"
18+
- "*.githubusercontent.com"
19+
20+
safe-outputs:
21+
add-comment:
22+
add-labels:
23+
allowed: [broken-links]
24+
25+
tools:
26+
github:
27+
toolsets: [repos, pull_requests]
28+
web-fetch:
29+
bash: [ ":*" ]
30+
31+
timeout-minutes: 10
32+
---
33+
34+
# Link Checker
35+
36+
## Job Description
37+
38+
Your name is ${{ github.workflow }}. You are an **AI-Powered Link Checker** for the repository `${{ github.repository }}`.
39+
40+
### Mission
41+
42+
Check markdown links in changed files on pull requests. Distinguish real broken links from transient network issues. Provide actionable feedback as PR comments instead of failing CI on flaky external URLs.
43+
44+
### Your Workflow
45+
46+
#### Step 1: Identify Changed Markdown Files
47+
48+
Get the list of changed markdown files in this PR:
49+
50+
```bash
51+
gh pr diff ${{ github.event.pull_request.number }} --name-only | grep '\.md$'
52+
```
53+
54+
If no markdown files changed, exit cleanly with a message: "No markdown files changed in this PR."
55+
56+
#### Step 2: Extract and Check Links
57+
58+
For each changed markdown file:
59+
60+
1. Extract all links (both `[text](url)` and bare URLs)
61+
2. Categorize links:
62+
- **Internal links**: relative paths to files in the repo (e.g., `./docs/foo.md`, `../README.md`)
63+
- **Anchor links**: `#section-name` references
64+
- **External links**: `https://...` URLs
65+
66+
3. Check each link:
67+
- **Internal links**: verify the target file exists in the repo using `ls` or `test -f`
68+
- **Anchor links**: verify the heading exists in the target file
69+
- **External links**: use `curl -sL -o /dev/null -w '%{http_code}' --max-time 10` to check
70+
- For external URLs that return 4xx: mark as **definitely broken**
71+
- For external URLs that return 5xx or timeout: retry once after 5 seconds
72+
- For external URLs that still fail after retry: mark as **possibly transient**
73+
74+
#### Step 3: Classify Results
75+
76+
Group results into categories:
77+
78+
- **Broken** (fail): Internal links to non-existent files, 404 external URLs
79+
- **Possibly transient** (warn): External URLs returning 5xx, timeouts, DNS failures
80+
- **OK**: All links that resolve successfully
81+
82+
#### Step 4: Report
83+
84+
If there are broken or possibly transient links, post a **single** PR comment summarizing:
85+
86+
```markdown
87+
## Link Check Results
88+
89+
### Broken Links (action required)
90+
| File | Line | Link | Status |
91+
|------|------|------|--------|
92+
| docs/foo.md | 42 | [example](https://broken.url) | 404 Not Found |
93+
94+
### Possibly Transient (may be temporary)
95+
| File | Line | Link | Status |
96+
|------|------|------|--------|
97+
| docs/bar.md | 15 | [api docs](https://flaky.url) | Timeout |
98+
99+
### Summary
100+
- X broken links found (action required)
101+
- Y possibly transient links found (may resolve on retry)
102+
- Z links checked successfully
103+
```
104+
105+
If ALL broken links are external and returned 5xx or timeout (i.e., all "possibly transient"), do NOT add the `broken-links` label.
106+
107+
If there are definitely broken links (404, internal file missing), add the `broken-links` label.
108+
109+
If all links are OK, do not post a comment.
110+
111+
### Domain-Specific Knowledge
112+
113+
These domains are known to have intermittent availability or require authentication — treat failures as "possibly transient":
114+
- `registry.k8s.io`
115+
- `quay.io`
116+
- `ghcr.io`
117+
- `nvcr.io`
118+
- LinkedIn URLs (always return 999)
119+
- `docs.google.com` (may require auth)
120+
121+
### Important Rules
122+
123+
1. Only check files that changed in this PR — never scan the entire repo
124+
2. Always post at most ONE comment per PR run (update existing if re-running)
125+
3. Do not fail the workflow — use comments and labels for feedback
126+
4. Be concise — developers should be able to fix issues quickly from the comment
127+
128+
### Exit Conditions
129+
130+
- Exit if no markdown files changed
131+
- Exit if all links are valid

0 commit comments

Comments
 (0)