forked from headroomlabs-ai/headroom
-
Notifications
You must be signed in to change notification settings - Fork 0
38 lines (34 loc) · 1.69 KB
/
Copy pathchangelog-guard.yml
File metadata and controls
38 lines (34 loc) · 1.69 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
name: Changelog Guard
# CHANGELOG.md is generated by release-please from Conventional Commit titles
# (see .release-please-config.json). Hand-editing it makes every concurrent PR
# conflict on the same `## Unreleased` lines — the "changelog cascade" where one
# merge turns the rest DIRTY. `.gitattributes merge=union` does not help because
# GitHub squash-merge ignores merge drivers. So the fix is to stop hand-edits at
# the source: this guard fails any PR that touches CHANGELOG.md, except
# release-please's own release PR (the one place it is meant to change).
#
# ponytail: uses the preinstalled gh CLI, no third-party action to pin. If a
# rare PR legitimately must edit CHANGELOG.md, a maintainer can merge past this
# non-required check; add a label-based exemption only if that ever recurs.
on:
pull_request:
permissions:
contents: read
pull-requests: read
jobs:
no-manual-changelog:
# release-please's release PR is the sole author of CHANGELOG.md.
if: ${{ !startsWith(github.head_ref, 'release-please--') }}
runs-on: ubuntu-latest
steps:
- name: Reject manual CHANGELOG.md edits
env:
GH_TOKEN: ${{ github.token }}
run: |
if gh pr view "${{ github.event.pull_request.number }}" \
--repo "${{ github.repository }}" \
--json files --jq '.files[].path' | grep -qx 'CHANGELOG.md'; then
echo "::error::Do not edit CHANGELOG.md by hand. release-please generates it from your Conventional Commit PR title (e.g. 'fix(proxy): ...'). Remove the CHANGELOG.md change — your entry appears automatically in the next release PR."
exit 1
fi
echo "OK — CHANGELOG.md not modified."