Skip to content

chore: add script to audit changelog labels on merged PRs#10391

Merged
paulbalandan merged 1 commit into
codeigniter4:developfrom
paulbalandan:pr-label-audit
Jul 8, 2026
Merged

chore: add script to audit changelog labels on merged PRs#10391
paulbalandan merged 1 commit into
codeigniter4:developfrom
paulbalandan:pr-label-audit

Conversation

@paulbalandan

Copy link
Copy Markdown
Member

Description
Follow-up to #10390. The changelog quality depends on PRs being labeled before the release notes are generated, but missing labels currently only surface at release time via the catch-all "Others" category. This PR adds admin/check-pr-labels.php (requires the authenticated GitHub CLI) so labels can be audited at any time:

  • Checks the PRs merged after a given release (php admin/check-pr-labels.php 4.7.3), defaulting to the latest release. The release's publish timestamp is resolved automatically, so there are no dates to remember.
  • Suggests the expected label from the PR title type: fix:bug, feat:new feature, perf:enhancement, refactor:refactor. Titles typed chore:/ci:/docs:/style:/test: need no changelog label and are ignored.
  • Applies the project's labeling nuances: the refactor suggestion is made only when the PR actually changes files under system/ (test-only refactors may use the testing label instead), and release process PRs ("Prep for x.y.z release", "x.y.z Ready code", "x.y.z Merge code") are skipped since they carry no labels.
  • PRs with no changelog label and no recognized title type are listed separately for manual review.
  • Prints a ready-to-run gh pr edit ... --add-label command per finding, so after reviewing the list the labels can be applied by pasting the block (minus any unwarranted lines).
  • On a TTY, output is colored and PR numbers are clickable OSC 8 hyperlinks. Piped output is plain text, and the command block is always unstyled for clean copying.
  • Exits 1 when suggested-label findings exist, so it can gate automation later.

Also included:

  • admin/RELEASE.md mentions running the script at any time in the Changelog section.
  • admin/README.md documents the script.
  • tests/system/AutoReview/CheckPrLabelsTest.php covers the usage errors offline and the default/versioned happy paths via gh, with the same explicit CI-skip message pattern as GenerateChangelogTest.

The script has already paid for itself: a run since v4.7.3 surfaced 20+ unlabeled feat: PRs targeting 4.8, two fix: PRs missing bug, and one system/-touching refactor: PR. The suggested labels have since been applied using the script's emitted commands, so a fresh run against the same release now reports no findings.

Checklist:

  • Securely signed commits
  • Component(s) with PHPDoc blocks, only if necessary or adds value (without duplication)
  • Unit testing, with >80% coverage
  • User guide updated
  • Conforms to style guide

@paulbalandan paulbalandan merged commit 1533c85 into codeigniter4:develop Jul 8, 2026
55 checks passed
@paulbalandan paulbalandan deleted the pr-label-audit branch July 8, 2026 18:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants