9595 contents : read
9696 runs-on : ubuntu-26.04
9797 timeout-minutes : 10
98+ outputs :
99+ changelog-modified : ${{ steps.changelog-check.outputs.modified }}
98100
99101 concurrency :
100102 cancel-in-progress : ${{ github.event_name == 'pull_request' || false }}
@@ -188,6 +190,20 @@ jobs:
188190 path : ${{ runner.temp }}/repo-size/
189191 if-no-files-found : error
190192
193+ - name : Check for CHANGELOG.md changes
194+ id : changelog-check
195+ if : steps.fetch-base.outcome == 'success'
196+ env :
197+ BASE_SHA : ${{ steps.fetch-base.outputs.merge_base }}
198+ HEAD_SHA : ${{ github.event.pull_request.head.sha }}
199+ run : |
200+ if ! git diff --exit-code --quiet "$BASE_SHA" "$HEAD_SHA" -- CHANGELOG.md; then
201+ echo "CHANGELOG.md was modified in this PR."
202+ echo "modified=true" >> "$GITHUB_OUTPUT"
203+ else
204+ echo "modified=false" >> "$GITHUB_OUTPUT"
205+ fi
206+
191207 - name : " Backport: Check out base ref"
192208 id : checkout-base
193209 if : ${{ startsWith(github.head_ref, 'backport-') }}
@@ -208,8 +224,8 @@ jobs:
208224 exit 1
209225 fi
210226
211- post-repo-size-comment :
212- name : Post repo size comment
227+ post-pr-comments :
228+ name : Post PR comments
213229 needs : other-checks
214230 # Keep write permissions isolated from the job that checks out and tests PR code. This job only
215231 # posts the candidate comment body produced by the read-only `pr-checks` job.
@@ -229,6 +245,22 @@ jobs:
229245 group : check-repo-size-${{ github.event.pull_request.number }}
230246
231247 steps :
248+ - name : Checkout repository
249+ uses : actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
250+ with :
251+ # Check out main, not the PR's head, since this job runs with
252+ # `pull-requests: write` permissions and must not execute untrusted code from the PR.
253+ ref : main
254+
255+ - name : Set up Node.js
256+ uses : actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
257+ with :
258+ node-version : 24
259+ cache : " npm"
260+
261+ - name : Install dependencies
262+ run : npm ci --workspace=pr-checks
263+
232264 - name : Download repo size comment
233265 uses : actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
234266 with :
@@ -258,3 +290,42 @@ jobs:
258290 else
259291 echo "Skipping repo size comment because the delta is below the threshold and no sticky comment exists."
260292 fi
293+
294+ - name : Post a warning about modifying CHANGELOG.md
295+ # Release, backport, mergeback, and bundle-update PRs deliberately modify CHANGELOG.md,
296+ # so skip comment management entirely for these automation flows.
297+ if : >-
298+ needs.other-checks.outputs.changelog-modified == 'true' &&
299+ !startsWith(github.event.pull_request.head.ref, 'update-v') &&
300+ !startsWith(github.event.pull_request.head.ref, 'backport-v') &&
301+ !startsWith(github.event.pull_request.head.ref, 'mergeback/') &&
302+ !startsWith(github.event.pull_request.head.ref, 'update-bundle/')
303+ uses : ./.github/actions/post-comment
304+ with :
305+ marker : " post-comment:CHANGELOG.md"
306+ body : |
307+ ⚠️ `CHANGELOG.md` has been modified in this PR. Please do not modify `CHANGELOG.md` directly.
308+ Instead, create a change-note file in `unreleased-change-notes/`. The `CHANGELOG.md`
309+ file will be automatically generated from those change-notes.
310+ See [`unreleased-change-notes/README.md`](https://github.com/github/codeql-action/blob/main/unreleased-change-notes/README.md) for more information.
311+ token : ${{ secrets.GITHUB_TOKEN }}
312+
313+ - name : Mark the CHANGELOG.md concern as resolved
314+ if : >-
315+ needs.other-checks.outputs.changelog-modified == 'false' &&
316+ !startsWith(github.event.pull_request.head.ref, 'update-v') &&
317+ !startsWith(github.event.pull_request.head.ref, 'backport-v') &&
318+ !startsWith(github.event.pull_request.head.ref, 'mergeback/') &&
319+ !startsWith(github.event.pull_request.head.ref, 'update-bundle/')
320+ uses : ./.github/actions/post-comment
321+ with :
322+ marker : " post-comment:CHANGELOG.md"
323+ update-only : true
324+ body : |
325+ ⚠️ `CHANGELOG.md` has been modified in this PR. Please do not modify `CHANGELOG.md` directly.
326+ Instead, create a change-note file in `unreleased-change-notes/`. The `CHANGELOG.md`
327+ file will be automatically generated from those change-notes.
328+ See [`unreleased-change-notes/README.md`](https://github.com/github/codeql-action/blob/main/unreleased-change-notes/README.md) for more information.
329+
330+ **Edit:** `CHANGELOG.md` is no longer modified in this PR. This concern is resolved.
331+ token : ${{ secrets.GITHUB_TOKEN }}
0 commit comments