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:
1010 pull-requests: read
1111
1212jobs:
13 check-pr:
14 name: Check PR
13 detect-changes:
14 name: Detect changes
1515 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 }}
1719 steps:
1820 - uses: actions/checkout@v4
1921 with:
2022 fetch-depth: 0
21
22 - name: Fetch base ref
23 run: git fetch --depth=1 origin ${{ github.event.pull_request.base.sha }}
24
23 - run: git fetch --depth=1 origin ${{ github.event.pull_request.base.sha }}
2524 - uses: actions/setup-python@v5
2625 with:
2726 python-version: "3.12"
28
2927 - run: pip install -q -r lib/requirements.txt
30
3128 - name: Detect changed files
3229 id: changes
3330 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 }}
3434
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
3547 - name: Check for direct README edits
36 id: readme
3748 run: python lib/checks/check-readme-edits.py --base-ref ${{ github.event.pull_request.base.sha }}
3849
39 - name: Schema validation
40 id: schema
41 if: steps.changes.outputs.yaml_changed == 'true'
50 schema:
51 name: Schema validation
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
4262 run: make validate
4363
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
4480 - name: YAML diff analysis
4581 id: diff
46 if: steps.changes.outputs.yaml_changed == 'true'
4782 run: python lib/checks/check-yaml-diff.py --base-ref ${{ github.event.pull_request.base.sha }}
48
49 - name: Link validation
50 if: steps.changes.outputs.yaml_changed == 'true' && steps.diff.outputs.has_service_changes == 'true'
83 - name: Upload diff data
84 if: always()
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
51108 run: python lib/checks/check-links.py --diff-json /tmp/pr-diff.json
52109
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
53119 - name: PR template check
54 id: template
55120 env:
56121 PR_BODY: ${{ github.event.pull_request.body }}
57122 run: python lib/checks/check-template.py
58123
59 - name: Non-YAML changes warning
60 if: steps.changes.outputs.non_yaml_changed == 'true'
61 run: python lib/checks/warn-non-yaml.py --base-ref ${{ github.event.pull_request.base.sha }}
62
124 comment:
125 name: Summary
126 if: always()
127 needs: [readme, schema, diff, links, template]
128 runs-on: ubuntu-latest
129 steps:
63130 - name: Save PR metadata
64 if: always()
65131 run: |
66132 mkdir -p /tmp/pr-meta
67133 echo "${{ github.event.pull_request.number }}" > /tmp/pr-meta/number.txt
68134 echo "${{ github.run_id }}" > /tmp/pr-meta/run-id.txt
69135
70136 - name: Build failure comment
71 if: failure()
137 if: contains(needs.*.result, 'failure')
72138 run: |
73139 cat > /tmp/pr-meta/comment.md << 'HEADER'
74140 <!-- pr-check-bot -->
@@ -76,7 +142,7 @@ jobs:
76142 > ## PR check failed
77143 HEADER
78144
79 if [ "${{ steps.readme.outcome }}" = "failure" ]; then
145 if [ "${{ needs.readme.result }}" = "failure" ]; then
80146 cat >> /tmp/pr-meta/comment.md << 'EOF'
81147
82148 ### Direct README edits
@@ -85,7 +151,7 @@ jobs:
85151 EOF
86152 fi
87153
88 if [ "${{ steps.schema.outcome }}" = "failure" ]; then
154 if [ "${{ needs.schema.result }}" = "failure" ]; then
89155 cat >> /tmp/pr-meta/comment.md << 'EOF'
90156
91157 ### Schema validation failed
@@ -94,7 +160,7 @@ jobs:
94160 EOF
95161 fi
96162
97 if [ "${{ steps.diff.outcome }}" = "failure" ]; then
163 if [ "${{ needs.diff.result }}" = "failure" ]; then
98164 cat >> /tmp/pr-meta/comment.md << 'EOF'
99165
100166 ### Single-entry rule
@@ -103,7 +169,16 @@ jobs:
103169 EOF
104170 fi
105171
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
107182 cat >> /tmp/pr-meta/comment.md << 'EOF'
108183
109184 ### PR template incomplete
@@ -112,7 +187,6 @@ jobs:
112187 EOF
113188 fi
114189
115 # Footer with link to logs
116190 printf '\n---\n*See the [workflow logs](%s/%s/actions/runs/%s) for full details.*\n' \
117191 "${{ github.server_url }}" "${{ github.repository }}" "${{ github.run_id }}" \
118192 >> /tmp/pr-meta/comment.md