[PM-39788] Add workflow to automatically label a PR by change type - #1197
Conversation
🤖 Bitwarden Claude Code ReviewOverall Assessment: APPROVE This PR adds a Code Review Details
Non-blocking nits (no inline comments posted): |
|
@bitwarden/team-admin-console-dev Please feel free to extend the label-pr.json now as needed or just keep it as is and refine it later. |
There was a problem hiding this comment.
Pull request overview
Adds SDLC automation to apply change-type labels (t:*) to pull requests so they can be used for GitHub release note categorization.
Changes:
- Introduces a new PR-triggered GitHub Actions workflow to auto-label PRs via
bitwarden/gh-actions/auto-label-pr-sdlc. - Adds
.github/label-pr.jsonconfiguration for title/path pattern matching to map PRs tot:*labels.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| .github/workflows/auto-label-pr-sdlc.yml | New workflow to run the auto-labeling action on PR events. |
| .github/label-pr.json | Adds the label-matching configuration consumed by the labeling action. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1197 +/- ##
============================
============================
☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.
Comments suppressed due to low confidence (2)
.github/label-pr.json:15
- The PR description says the workflow applies one of the
t:*change-type labels, but this config includes a non-t:label key (feature-flag). This can lead to inconsistent labeling expectations (and may create/require a label that doesn't fit the documented scheme).
"path_patterns": {
"t:feature": [],
"t:tech-debt": [],
.github/workflows/auto-label-pr-sdlc.yml:6
- Using the
pull_requestevent can prevent this workflow from applying labels on PRs opened from forks because theGITHUB_TOKENis read-only in that context, even if you requestpull-requests: write. If you want auto-labeling to work for fork PRs, switch topull_request_targetand ensure you only use base-repo context (no checkout of untrusted PR code).
on:
pull_request:
types: [opened, synchronize, reopened]
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.
Comments suppressed due to low confidence (1)
.github/workflows/auto-label-pr-sdlc.yml:6
- This workflow both (1) needs write permissions to apply labels and (2) matches labels using PR title patterns. With
pull_request, fork PRs will get a read-onlyGITHUB_TOKENso labeling will fail; and withoutedited, title changes after opening won’t trigger re-labeling. Switching topull_request_targetand addingeditedmakes labeling work reliably while still avoiding executing untrusted PR code (this workflow only checks out the base repo by default).
on:
pull_request:
types: [opened, synchronize, reopened]
🎟️ Tracking
https://bitwarden.atlassian.net/browse/PM-39788
Depends on bitwarden/gh-actions#829
📔 Objective
Adds a workflow that gets triggered when a PR is opened, synchronized or re-opened. It calls a composite action living in bitwarden/gh-actions and passes the PR number and any existing labels to it. The composite action looks for a configuration file (
.github/label-pr.json) and tries to match the change type via PR title and/or changed files.It then applies one of the labels
t:*to the PR.These change type labels are then used to create categories for the Github release notes.