Skip to content

[PM-34710] Create composite action to label PR by change type via title or changed files#829

Open
djsmith85 wants to merge 5 commits into
mainfrom
ps/pm-34710/create-composite-action-to-auto-label-prs
Open

[PM-34710] Create composite action to label PR by change type via title or changed files#829
djsmith85 wants to merge 5 commits into
mainfrom
ps/pm-34710/create-composite-action-to-auto-label-prs

Conversation

@djsmith85

Copy link
Copy Markdown

🎟️ Tracking

https://bitwarden.atlassian.net/browse/PM-34710

📔 Objective

To be able to create automated release notes, we need to categorize PRs by changes (bugfix, feature, dep-updates, etc).

I started with the example from the android repo: https://github.com/bitwarden/android/blob/main/.github/workflows/sdlc-label-pr.yml. As I wanted this workflow to be usable from all repos, it needed to be created here as a composite action. The majority of the work is done by label-pr.py.

label-pr.py originates from https://github.com/bitwarden/android/blob/main/.github/scripts/label-pr.py, but got extended to allow a git like ignore syntax for file-paths.

A small workflow is added to each repo that would like to use this composite action and it will also provide a configuration, by which the python script matches patterns to labels needing applied.

@djsmith85 djsmith85 requested a review from a team as a code owner June 22, 2026 19:19
@djsmith85 djsmith85 requested a review from gitclonebrian June 22, 2026 19:19
@github-actions

github-actions Bot commented Jun 22, 2026

Copy link
Copy Markdown

🤖 Bitwarden Claude Code Review

Overall Assessment: APPROVE

Reviewed the new auto-label-pr-sdlc composite action: action.yml, label-pr.py, and README.md. The action labels PRs from conventional-commit title prefixes and changed file paths, with add/replace modes, dry-run, and .gitignore-style negation. Input handling in action.yml correctly passes user-controlled values via environment variables and argv arrays (no shell interpolation), and gh calls use argument lists rather than shell strings, so command injection is not a concern. No blocking issues found.

Code Review Details
  • ❓ : The README example workflow uses the pull_request trigger with pull-requests: write. For PRs from forks, GITHUB_TOKEN is read-only regardless of declared permissions, so gh pr edit / gh api PATCH would fail with 403. If this action is meant to label fork contributions, the trigger/token model may need revisiting; if it only targets same-repo branch PRs, no change is needed.
    • auto-label-pr-sdlc/README.md:54

Notes (no action required):

  • No test workflow (test-auto-label-pr-sdlc.yml) was added for this action; other actions in this repo follow that convention. Consider adding one for label-pr.py matching logic.
  • PR titles are attacker-controllable and are printed raw to the step log (label-pr.py:258); GitHub Actions interprets ::workflow-command:: sequences in output. Practical impact is low, but masking/escaping untrusted titles in logs would harden it.

@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
C Security Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

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.

1 participant