Repository navigation
120 lines (98 loc) · 3.73 KB
/
Copy pathcheck-pr.yml
File metadata and controls
120 lines (98 loc) · 3.73 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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
name: Check PR
on:
pull_request:
push:
branches:
- main
permissions:
contents: read
issues: read
pull-requests: read
jobs:
check-pr:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v7
- name: Install pnpm
uses: pnpm/action-setup@v6
with:
version: 11.17.0
- name: Setup Node
uses: actions/setup-node@v7
with:
node-version: 24
cache: pnpm
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Install Playwright browsers
run: pnpm exec playwright install chromium --with-deps
- name: Lint
run: pnpm lint
- name: Test
run: pnpm test
- name: Format check
run: pnpm run format:check
- name: Build
run: pnpm build
- name: Build MCP server
run: pnpm --filter @devschile/chucao-mcp build
- name: Check MCP bin
run: pnpm --filter @devschile/chucao-mcp check:bin
- name: Test MCP server
run: pnpm --filter @devschile/chucao-mcp test
- name: Generate gallery
run: pnpm run generate:gallery
- name: Generate llms.txt
run: pnpm run generate:llms
- name: Check the AI surfaces still resolve
run: pnpm run check:ai
# The generators above rewrite tracked files. Without this the CI runs
# them and throws the result away, so a pull request can commit stale
# generated output and still go green.
- name: Check generated output is committed
run: |
if ! git diff --exit-code; then
echo "::error::Generated files are out of date. Run 'pnpm build && pnpm run generate:gallery && pnpm run generate:llms' and commit the result."
exit 1
fi
# Runs after the squash merge, on main, where the PR number is the only one in
# the event. A `Refs #N` that shipped its work and left the issue open is
# exactly what happened to #42 and #92 in 2.5.0: the reference was correct
# while the issue was still a decision, and nothing re-read it afterwards.
audit-issue-refs:
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
permissions:
contents: read
issues: read
pull-requests: read
steps:
- name: Checkout
uses: actions/checkout@v7
- name: Setup Node
uses: actions/setup-node@v7
with:
node-version: 24
# Reports in the job log and as an annotation instead of failing the
# build: the squash already landed, and a `Refs` that genuinely advances
# an issue is legitimate. The point is that someone sees it.
- name: Report issues a merged PR left open
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
HEAD_SHA: ${{ github.sha }}
run: |
# A push event has no pull_request payload, so the PR is resolved from
# the merged commit: the squash merge is a single commit on main, and
# GitHub associates it with the PR that produced it.
PR_NUMBER=$(curl -sf \
-H "authorization: Bearer $GH_TOKEN" \
-H "accept: application/vnd.github+json" \
"https://api.github.com/repos/$GITHUB_REPOSITORY/commits/$HEAD_SHA/pulls" \
| node -e 'let s="";process.stdin.on("data",d=>s+=d).on("end",()=>{const p=JSON.parse(s||"[]");const m=p.find(x=>x.merged_at)??p[0];console.log(m?m.number:"")})' || true)
if [ -z "$PR_NUMBER" ]; then
echo "no merged pull request associated with $HEAD_SHA, nothing to audit"
exit 0
fi
echo "auditing merged PR #$PR_NUMBER"
node scripts/check-merged-issue-refs.mjs --pr "$PR_NUMBER"