ci: add PR auto-labeler and auto-generated release notes - #301
Conversation
- .github/workflows/pr-labeler.yml: labels PRs from conventional-commit title prefix (feat -> enhancement, fix -> bug, docs -> documentation, chore/refactor/style/test/ci/build/revert -> chore, perf -> enhancement). Runs on pull_request opened/edited/synchronize. No secrets needed. - .github/release.yml: maps those labels to release note section headings (New Features, Bug Fixes, Documentation, Chores, Other Changes). PRs tagged skip-changelog are excluded. - .github/workflows/release.yml: replace manual git-log notes block with --generate-notes so GitHub builds categorized release notes from the label config automatically on every release dispatch. NOTE for repo owner: create a 'chore' label in lidge-jun/opencodex gh label create chore --repo lidge-jun/opencodex --color 'e4e669' --description 'Maintenance, refactors, CI, and non-user-facing changes'
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
📝 WalkthroughWalkthroughAdds automated PR labeling from conventional-commit titles and configures GitHub release notes to group labeled changes while excluding skipped PRs. ChangesRelease automation
Estimated code review effort: 3 (Moderate) | ~20 minutes Suggested reviewers: Sequence Diagram(s)sequenceDiagram
participant GitHub as GitHub PR event
participant Workflow as pr-labeler workflow
participant PRAPI as GitHub PR API
GitHub->>Workflow: Trigger on PR opened, edited, or synchronized
Workflow->>Workflow: Parse conventional-commit title prefix
Workflow->>PRAPI: Read labels and existing bot comments
PRAPI-->>Workflow: Return PR metadata
Workflow->>PRAPI: Remove stale type labels or add detected label
Workflow->>PRAPI: Post prefix nudge comment when needed
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
When no prefix is detected, post a one-time comment tagging the PR creator with examples and a note that the workflow will re-run once the title is updated. Uses an HTML comment marker to avoid posting the same nudge twice on subsequent edits.
pull_request runs in the fork context, where GITHUB_TOKEN is read-only even with write permissions declared. pull_request_target always runs in the base repo context so the token can write labels and comments. Safe here because we never check out fork code.
|
@coderabbitai review |
✅ Action performedReview finished.
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 714cbb6219
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
…title If a PR was labeled 'enhancement' from 'feat: ...' and the author edits the title to remove the prefix, the old label was left behind and would still categorize the PR in release notes. Now clears any managed type label before posting the nudge comment.
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (1)
.github/workflows/pr-labeler.yml (1)
58-66: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winDuplicate-comment check doesn't paginate.
listCommentsdefaults to the first page (30 items, oldest first). On a PR that accumulates more than 30 comments, this lookup could still find the marker for typical cases (it's usually posted early), but relying on default pagination is fragile — considergithub.paginateto be safe.♻️ Proposed fix
- const existing = await github.rest.issues.listComments({ - owner: context.repo.owner, - repo: context.repo.repo, - issue_number: pr, - }); - const alreadyCommented = existing.data.some( + const existingComments = await github.paginate(github.rest.issues.listComments, { + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: pr, + }); + const alreadyCommented = existingComments.some( c => c.user.login === 'github-actions[bot]' && c.body.includes('<!-- opencodex-label-nudge -->') );🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In @.github/workflows/pr-labeler.yml around lines 58 - 66, Update the existing-comments lookup in the labeler workflow to use github.paginate with issues.listComments, ensuring all PR comments are searched for the opencodex-label-nudge marker. Preserve the existing alreadyCommented check and comment-posting behavior.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In @.github/workflows/pr-labeler.yml:
- Around line 31-54: Update the PREFIX_TO_LABEL lookup used to compute detected
so inherited Object.prototype names such as constructor, toString, and
hasOwnProperty resolve as no prefix. Use an own-property guard or a
null-prototype mapping before returning the mapped label, while preserving
normal case-insensitive prefix handling and the existing no-prefix branch.
In @.github/workflows/release.yml:
- Around line 289-295: Update the existing-release branch in the release
workflow to generate release notes before invoking gh release edit, then pass
the generated notes via the supported --notes or --notes-file option while
preserving the release title and prerelease behavior. Keep the gh release create
path unchanged.
---
Nitpick comments:
In @.github/workflows/pr-labeler.yml:
- Around line 58-66: Update the existing-comments lookup in the labeler workflow
to use github.paginate with issues.listComments, ensuring all PR comments are
searched for the opencodex-label-nudge marker. Preserve the existing
alreadyCommented check and comment-posting behavior.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: cae5cc9c-31e5-46ed-af5f-eb2f3624f850
📒 Files selected for processing (3)
.github/release.yml.github/workflows/pr-labeler.yml.github/workflows/release.yml
…t notes pr-labeler.yml: use hasOwnProperty guard on PREFIX_TO_LABEL so prefixes like 'constructor' or 'toString' don't resolve to inherited prototype members and blow up the addLabels call. release.yml: gh release edit does not support --generate-notes (only gh release create does). For the edit path, call the GitHub generate-notes API directly and pass the result via --notes-file instead.
…busy PRs listComments returns only the first 30 by default. On a PR with 30+ comments the marker could be on a later page, causing a second nudge. Use github.paginate to fetch all comments before checking.
|
Post-merge Sol review note: Reverted from |
Combined issue-translator (#299) and issue-deduplicator (#298) into a single issue-triage.yml with deterministic translate→dedup sequencing and split inference/mutation permissions. Rebuilt pr-labeler (#301) with graceful label creation and live title refetch. Updated release.yml with --notes-start-tag for explicit range. Addresses all Sol review findings. Original ideas credited to Wibias. Co-authored-by: Wibias <37517432+Wibias@users.noreply.github.com> Based-on: PR #301, PR #298, PR #299
Combined issue-translator (#299) and issue-deduplicator (#298) into a single issue-triage.yml with deterministic translate→dedup sequencing and split inference/mutation permissions per job. Rebuilt pr-labeler (#301) with graceful label creation (creates missing labels instead of failing) and live title refetch before mutation. Added .github/release.yml category config for auto-generated notes. Addresses all Sol review findings: deterministic sequencing, split permissions, label prerequisites, BOM removal, EOF newlines. Co-authored-by: Wibias <37517432+Wibias@users.noreply.github.com> Based-on: PR #301, PR #298, PR #299
What
Adds a zero-cost, fully automated release notes system matching the style of openai/codex releases (New Features / Bug Fixes / Documentation / Chores sections + full changelog link).
Three changes:
1.
.github/workflows/pr-labeler.yml(new)Fires on every PR open/edit. Reads the conventional-commit prefix from the title (
feat:,fix:,docs:,chore:,refactor:,perf:, etc.) and applies the matching GitHub label automatically. No API keys, no external services — runs entirely with the built-inGITHUB_TOKEN.enhancementbugdocumentationchoreIf someone edits a PR title and changes the type, the old label is removed and the new one applied. If a PR title has no recognized prefix, the bot posts a one-time comment tagging the PR creator with examples.
2.
.github/release.yml(new)Tells GitHub how to group those labels into release note sections. GitHub reads this file automatically when
--generate-notesis used.3.
.github/workflows/release.yml(updated)Replaces the manual
git logcommit dump withgh release create --generate-notes. On every release dispatch, GitHub now builds the categorized release notes from merged PR labels instead of a flat commit list.Why
The old release notes were a raw
git logdump — no structure, no categories, hard to read. This makes every release look like the openai/codex releases with zero ongoing maintenance: just label PRs (or let the labeler do it) and dispatch the release workflow.Setup required (one-time, before merging)
One label needs to be created manually — the others (
bug,documentation,enhancement) already exist in this repo:How to cut a release (after merging)
package.jsononmainversion, settagtolatest, leavedry-run: truefirst to verifydry-run: falseGitHub will scan all PRs merged since the previous tag, group them by label, and the release page will look like:
Verification
pr-labeler.ymlusespull_request_targetso the token has write access even for fork PRspr-labeler.ymluses a pinned SHA foractions/github-scriptrelease.ymlfollows the GitHub changelog config schemarelease.ymlworkflow diff is minimal — only the notes generation block changed, all guards and version checks are untouched