Repository navigation
ci: generate CHANGELOG entries from the issues that merged PRs close - #1252
rodrigobustamante wants to merge 2 commits into
Conversation
Add .github/scripts/changelog-from-prs.mjs, which reads the closing issues of merged pull requests and writes one line per issue into [Unreleased], with the issue title verbatim and the section picked from the issue labels. The release job runs it before the bump, the release preview shows the entries, and a new warn-only check asks every PR to be linked to an issue. Contributors no longer edit code/CHANGELOG.md. Refs InditexTech#1236 Signed-off-by: Rodrigo Bustamante <rbustamantejelvez@gmail.com>
Contribution License Agreement - Valid 🟢All commits contain valid signoff. As a confirmation, remember that you are agreeing to our Contribution License Agreement. |
|
Hi @rodrigobustamante, thanks for this. The write-up and the dry-run numbers made it easy to review. I ran your tests on the PR head with Node 24.14.1 ( Overall: I'm happy with the design and would merge it with Should settle before enforcing1. An issue can be listed again in a later release.
2. Tracking issues create noise entries (your question 1).
Smaller points3. Section order. An issue with both 4. On your "known limits"Bypass via the PR itself.
A PR that edits the script or workflow therefore needs an admin review, so no new CODEOWNERS rule is needed. Gaps for the maintainers, none caused by this PR:
Things I checked that are fine
Not verified
Maintainer-onlyThe
|
…entries Issues labelled internal or kind/internal, such as release tracking issues, are reported instead of written, and an issue already listed in an earlier release is not listed again. A truncated GraphQL page now says which limit to raise. Refs InditexTech#1236 Signed-off-by: Rodrigo Bustamante <rbustamantejelvez@gmail.com>
|
Thanks for the thorough review, and for checking the branch protection side. Points 1, 2 and 4 are addressed in bc11e72. 1. Issues already released. An entry whose issue is already listed in any released section is now skipped, and the report warns about it:
That line comes from a dry-run of 2. Out-of-scope issues. Issues labelled 3. Section order. Noted. I'll follow #1253 for my three issues. 4. The 20-PR cap. The error now names the connection and the next step, for example:
The same applies to the labels and closing-issue limits. Tests: 29 pass ( For the |
Closes #1236
Implements the flow agreed in #1236 as a single PR: script, tests, dry-run, the always-on check and preview, the release wiring and the docs. Please merge it with
skip-release.What changes
.github/scripts/changelog-from-prs.mjs, one script with two modes that share the code:--pr N: read-only check and preview of one PR.git describe --tags --abbrev=0 --match '[0-9]*'→ first-parent commits since that tag → their merged PRs into--branch→ each PR's closing issues. No date filter.security→ Security,bug→ Fixed,enhancement/kind/feature→ Added, otherwise Changed with a "section guessed" warning.[Unreleased], keeps manual lines, never repeats an issue already listed there, and is idempotent. Before writing it checks that nothing outside[Unreleased]changes.--dry-run --from X --to Yprints the entries and compares them with the hand-written[Y]section.node --test .github/scripts/changelog-from-prs.test.mjs(24 tests, no dependencies).code-changelog-check.yml(new): runs on every PR tomain/main-*onopened,synchronize,ready_for_review,labeled,unlabeledandedited. It writes the result to the job summary, so it works on fork PRs. It is warn-only throughCHANGELOG_LINK_ENFORCE: 'false'; the follow-up PR flips it to'true'after the next release. Dependabot is exempt.code-release_preview.yml:<sha>". On fork PRs it goes to the job summary.issues: read.keep-a-changelog bump, so the signed CHANGELOG commit includes the entries.publish-snapshotis unchanged.release-type/minorsaying "major") and the release-docs step..github/pull_request_template.mdwith theCloses #line..github/workflows/docs/.bumpwith an empty[Unreleased]: it already happened in the 5.5.0 release (3aff8d2 bumped an empty section), so snapshots and releases with no entries keep working.One deviation from the agreed rule:
skip-releaseRunning the dry-run showed that
skip-releasecannot mean "no changelog entry". Most PRs are merged withskip-releaseand released together by a later PR. In 5.6.0..5.7.0, 8 of the 9 PRs have it, mine included, and their entries are part of 5.7.0.skip-release= no entryskip-releasekeeps linked issuesSo in this PR,
skip-release:A
skip-releasePR with no linked issue simply gets no entry. The preview comment and CONTRIBUTING state this. If you prefer your original rule, it is a three-line change inbuildEntries.Validation (
--dry-run)enhancement, so they move from Fixed to Added. That is my labelling, and I'll relabel them asbugif you agree.enhancementbut was written under Fixed.Questions for you
internallabel is described as "out of the scope for changelog files", andRelease docs Xissues would appear as Changed in every release. Should issues labelledinternal(and maybedocs/release) be skipped, listed in the report instead of silently? Your rule says anything else goes to Changed, so I left them in.skip-release: "Do not publish a release on merge. The PR does not need a linked issue; the issues it closes go into the next release."pull_request, so it runs the PR's own copy of the script and workflow. Once it enforces, a PR that edits them could pass without a link. CODEOWNERS on.github/is the usual guard.@teammention would ping from the bot's preview comment.Rollout
skip-release.CHANGELOG_LINK_ENFORCE: 'true'.