Commit 66d9970144

66d9970144f2c043e32e5ab31b2d6cf4c06e0df3

parent: adc0df53a5

Unsigned

Alicia Sykes <alicia@omg.lol> · 2026-02-22 22:54 UTC

Updates PR Check

Layout: unified · split

.github/workflows/pr-check.yml +103 −29
@@ -10,65 +10,131 @@ permissions:
10 pull-requests: read 10 pull-requests: read
11 11
12jobs: 12jobs:
13 check-pr: 13 detect-changes:
14 name: Check PR 14 name: Detect changes
15 runs-on: ubuntu-latest 15 runs-on: ubuntu-latest
16 16 outputs:
17 yaml_changed: ${{ steps.changes.outputs.yaml_changed }}
18 non_yaml_changed: ${{ steps.changes.outputs.non_yaml_changed }}
17 steps: 19 steps:
18 - uses: actions/checkout@v4 20 - uses: actions/checkout@v4
19 with: 21 with:
20 fetch-depth: 0 22 fetch-depth: 0
21 23 - run: git fetch --depth=1 origin ${{ github.event.pull_request.base.sha }}
22 - name: Fetch base ref
23 run: git fetch --depth=1 origin ${{ github.event.pull_request.base.sha }}
24
25 - uses: actions/setup-python@v5 24 - uses: actions/setup-python@v5
26 with: 25 with:
27 python-version: "3.12" 26 python-version: "3.12"
28
29 - run: pip install -q -r lib/requirements.txt 27 - run: pip install -q -r lib/requirements.txt
30
31 - name: Detect changed files 28 - name: Detect changed files
32 id: changes 29 id: changes
33 run: python lib/checks/detect-changes.py --base-ref ${{ github.event.pull_request.base.sha }} 30 run: python lib/checks/detect-changes.py --base-ref ${{ github.event.pull_request.base.sha }}
31 - name: Non-YAML changes warning
32 if: steps.changes.outputs.non_yaml_changed == 'true'
33 run: python lib/checks/warn-non-yaml.py --base-ref ${{ github.event.pull_request.base.sha }}
34 34
35 readme:
36 name: README edits
37 runs-on: ubuntu-latest
38 steps:
39 - uses: actions/checkout@v4
40 with:
41 fetch-depth: 0
42 - run: git fetch --depth=1 origin ${{ github.event.pull_request.base.sha }}
43 - uses: actions/setup-python@v5
44 with:
45 python-version: "3.12"
46 - run: pip install -q -r lib/requirements.txt
35 - name: Check for direct README edits 47 - name: Check for direct README edits
36 id: readme
37 run: python lib/checks/check-readme-edits.py --base-ref ${{ github.event.pull_request.base.sha }} 48 run: python lib/checks/check-readme-edits.py --base-ref ${{ github.event.pull_request.base.sha }}
38 49
39 - name: Schema validation 50 schema:
40 id: schema 51 name: Schema validation
41 if: steps.changes.outputs.yaml_changed == 'true' 52 needs: detect-changes
53 if: needs.detect-changes.outputs.yaml_changed == 'true'
54 runs-on: ubuntu-latest
55 steps:
56 - uses: actions/checkout@v4
57 - uses: actions/setup-python@v5
58 with:
59 python-version: "3.12"
60 - run: pip install -q -r lib/requirements.txt
61 - name: Validate schema
42 run: make validate 62 run: make validate
43 63
64 diff:
65 name: Single-entry rule
66 needs: detect-changes
67 if: needs.detect-changes.outputs.yaml_changed == 'true'
68 runs-on: ubuntu-latest
69 outputs:
70 has_service_changes: ${{ steps.diff.outputs.has_service_changes }}
71 steps:
72 - uses: actions/checkout@v4
73 with:
74 fetch-depth: 0
75 - run: git fetch --depth=1 origin ${{ github.event.pull_request.base.sha }}
76 - uses: actions/setup-python@v5
77 with:
78 python-version: "3.12"
79 - run: pip install -q -r lib/requirements.txt
44 - name: YAML diff analysis 80 - name: YAML diff analysis
45 id: diff 81 id: diff
46 if: steps.changes.outputs.yaml_changed == 'true'
47 run: python lib/checks/check-yaml-diff.py --base-ref ${{ github.event.pull_request.base.sha }} 82 run: python lib/checks/check-yaml-diff.py --base-ref ${{ github.event.pull_request.base.sha }}
48 83 - name: Upload diff data
49 - name: Link validation 84 if: always()
50 if: steps.changes.outputs.yaml_changed == 'true' && steps.diff.outputs.has_service_changes == 'true' 85 uses: actions/upload-artifact@v4
86 with:
87 name: pr-diff
88 path: /tmp/pr-diff.json
89 if-no-files-found: ignore
90
91 links:
92 name: Link validation
93 needs: diff
94 if: needs.diff.result == 'success' && needs.diff.outputs.has_service_changes == 'true'
95 runs-on: ubuntu-latest
96 steps:
97 - uses: actions/checkout@v4
98 - uses: actions/setup-python@v5
99 with:
100 python-version: "3.12"
101 - run: pip install -q -r lib/requirements.txt
102 - name: Download diff data
103 uses: actions/download-artifact@v4
104 with:
105 name: pr-diff
106 path: /tmp
107 - name: Validate links
51 run: python lib/checks/check-links.py --diff-json /tmp/pr-diff.json 108 run: python lib/checks/check-links.py --diff-json /tmp/pr-diff.json
52 109
110 template:
111 name: PR template
112 runs-on: ubuntu-latest
113 steps:
114 - uses: actions/checkout@v4
115 - uses: actions/setup-python@v5
116 with:
117 python-version: "3.12"
118 - run: pip install -q -r lib/requirements.txt
53 - name: PR template check 119 - name: PR template check
54 id: template
55 env: 120 env:
56 PR_BODY: ${{ github.event.pull_request.body }} 121 PR_BODY: ${{ github.event.pull_request.body }}
57 run: python lib/checks/check-template.py 122 run: python lib/checks/check-template.py
58 123
59 - name: Non-YAML changes warning 124 comment:
60 if: steps.changes.outputs.non_yaml_changed == 'true' 125 name: Summary
61 run: python lib/checks/warn-non-yaml.py --base-ref ${{ github.event.pull_request.base.sha }} 126 if: always()
62 127 needs: [readme, schema, diff, links, template]
128 runs-on: ubuntu-latest
129 steps:
63 - name: Save PR metadata 130 - name: Save PR metadata
64 if: always()
65 run: | 131 run: |
66 mkdir -p /tmp/pr-meta 132 mkdir -p /tmp/pr-meta
67 echo "${{ github.event.pull_request.number }}" > /tmp/pr-meta/number.txt 133 echo "${{ github.event.pull_request.number }}" > /tmp/pr-meta/number.txt
68 echo "${{ github.run_id }}" > /tmp/pr-meta/run-id.txt 134 echo "${{ github.run_id }}" > /tmp/pr-meta/run-id.txt
69 135
70 - name: Build failure comment 136 - name: Build failure comment
71 if: failure() 137 if: contains(needs.*.result, 'failure')
72 run: | 138 run: |
73 cat > /tmp/pr-meta/comment.md << 'HEADER' 139 cat > /tmp/pr-meta/comment.md << 'HEADER'
74 <!-- pr-check-bot --> 140 <!-- pr-check-bot -->
@@ -76,7 +142,7 @@ jobs:
76 > ## PR check failed 142 > ## PR check failed
77 HEADER 143 HEADER
78 144
79 if [ "${{ steps.readme.outcome }}" = "failure" ]; then 145 if [ "${{ needs.readme.result }}" = "failure" ]; then
80 cat >> /tmp/pr-meta/comment.md << 'EOF' 146 cat >> /tmp/pr-meta/comment.md << 'EOF'
81 147
82 ### Direct README edits 148 ### Direct README edits
@@ -85,7 +151,7 @@ jobs:
85 EOF 151 EOF
86 fi 152 fi
87 153
88 if [ "${{ steps.schema.outcome }}" = "failure" ]; then 154 if [ "${{ needs.schema.result }}" = "failure" ]; then
89 cat >> /tmp/pr-meta/comment.md << 'EOF' 155 cat >> /tmp/pr-meta/comment.md << 'EOF'
90 156
91 ### Schema validation failed 157 ### Schema validation failed
@@ -94,7 +160,7 @@ jobs:
94 EOF 160 EOF
95 fi 161 fi
96 162
97 if [ "${{ steps.diff.outcome }}" = "failure" ]; then 163 if [ "${{ needs.diff.result }}" = "failure" ]; then
98 cat >> /tmp/pr-meta/comment.md << 'EOF' 164 cat >> /tmp/pr-meta/comment.md << 'EOF'
99 165
100 ### Single-entry rule 166 ### Single-entry rule
@@ -103,7 +169,16 @@ jobs:
103 EOF 169 EOF
104 fi 170 fi
105 171
106 if [ "${{ steps.template.outcome }}" = "failure" ]; then 172 if [ "${{ needs.links.result }}" = "failure" ]; then
173 cat >> /tmp/pr-meta/comment.md << 'EOF'
174
175 ### Link validation failed
176 One or more URLs in your entry could not be verified.
177 Please ensure all links are correct and accessible.
178 EOF
179 fi
180
181 if [ "${{ needs.template.result }}" = "failure" ]; then
107 cat >> /tmp/pr-meta/comment.md << 'EOF' 182 cat >> /tmp/pr-meta/comment.md << 'EOF'
108 183
109 ### PR template incomplete 184 ### PR template incomplete
@@ -112,7 +187,6 @@ jobs:
112 EOF 187 EOF
113 fi 188 fi
114 189
115 # Footer with link to logs
116 printf '\n---\n*See the [workflow logs](%s/%s/actions/runs/%s) for full details.*\n' \ 190 printf '\n---\n*See the [workflow logs](%s/%s/actions/runs/%s) for full details.*\n' \
117 "${{ github.server_url }}" "${{ github.repository }}" "${{ github.run_id }}" \ 191 "${{ github.server_url }}" "${{ github.repository }}" "${{ github.run_id }}" \
118 >> /tmp/pr-meta/comment.md 192 >> /tmp/pr-meta/comment.md