ci: block merges that skip CHANGELOG.md or contributor credit - #128
Conversation
Closes PhilanthroPy-Project#113. A credit-guard job runs scripts/check_credit.sh on every pull request: if the diff touches philanthropy/, the PR must also touch CHANGELOG.md and its author must already appear in CONTRIBUTORS.md. Runs only on pull_request events, so direct pushes and pre-guard history are never re-litigated. Verified against four scenarios locally: source change without changelog (fails), uncredited author (fails), credited author with changelog (passes), tests-only diff (skips).
|
CI is green and the script/workflow wiring looks solid, but per AGENTS.md every PR needs an entry under |
Per AGENTS.md, every PR needs an entry under [Unreleased]. Describes the new scripts/check_credit.sh wiring and its two gates (changelog touched, author credited) for PRs that touch philanthropy/.
|
Done in c4c159a: added the entry under |
Signed-off-by: slegarraga <slegarraga@users.noreply.github.com>
|
Reviewed. The script and the intent look right, but this cannot merge as-is: the
credit-guard:
name: Changelog and contributor credit (issue #113)
if: github.event_name == 'pull_request'
runs-on: ubuntu-latestTwo smaller notes, neither blocking:
Also: GitHub still reports this branch as CONFLICTING, but that state is stale -- |
- credit-guard now has 'if: github.event_name == pull_request' so post-merge pushes to main do not invoke check_credit.sh with empty SHAs (review note from shivamlalakiya; makes the CHANGELOG claim literally true in YAML). - check_credit.sh matches the @login token literally via awk index instead of interpolating it into an ERE, so bot logins like dependabot[bot] are not parsed as a character class. Verified with a 7-case harness covering human/bot/prefix/skip/changelog/empty-author paths.
|
Fixed both points and pushed as 0af3a45 (branch also merged current
Verification before pushing:
On your last note, agreed the touched-file check is the weaker form; leaving it as-is for this guard per your framing. And thanks for the sharp catch, every post-merge run on |
Closes #113.
What
scripts/check_credit.sh: given base/head SHAs and the PR author login, fails when the diff touches files underphilanthropy/without also touchingCHANGELOG.md, or when the author's handle is absent fromCONTRIBUTORS.md. Emits GitHub::error::annotations so the failure surfaces inline on the Files tab.credit-guardjob inci.ymlwires it up onpull_requestevents only — direct pushes to main and history that predates the guard are never re-litigated, per the issue's done-when.Verified locally against real diffs:
Design choices worth flagging:
@handlestring in CONTRIBUTORS.md, matching the file's existing format.