Skip to content

[PM-22159] ci: Add automated PR labelling based on file paths and title patterns#2225

Merged
vvolkgang merged 5 commits intomainfrom
vvolkgang/label-prs
Jan 12, 2026
Merged

[PM-22159] ci: Add automated PR labelling based on file paths and title patterns#2225
vvolkgang merged 5 commits intomainfrom
vvolkgang/label-prs

Conversation

@vvolkgang
Copy link
Copy Markdown
Member

🎟️ Tracking

PM-22159

📔 Objective

Note

Mostly a copypaste from bitwarden/android#6157 with the exception of label-pr.json

Automate pull request labelling based on changed file paths and PR title patterns following conventional commits format, as a first step towards release notes with automated ✨ categories ✨ !

  • JSON configuration: Label patterns defined in .github/label-pr.json - planned using yaml initially but it would require an external dependency, introducing the need for python environment and dependency management. Python supports json deserialization out of the box. File based config will allow us to centralise these scripts in our gh-actions repo later down the line.
  • Labeling modes (add or replace) - In order to keep labels up-to-date in our PRs we'll replace them when they're updated, with the exception of Community PRs and our automated PRs where we'll add instead, preserving labels set by other automations.
  • Raw python script without additional dependencies - faster workflows and easier local testing.

Labels

App Labels (from file paths):

  • app:password-manager - Password manager app changes
  • app:authenticator - Authenticator app changes

Change Type Labels:

  • t:feature-app - Addition or improvement of Product features
  • t:feature-tool - Addition or improvement of Tool features (e.g. Test Harness)
  • t:bug - Bug fixes
  • t:tech-debt - Technical debt, refactoring, cleanup
  • t:docs - Documentation changes
  • t:ci - CI/CD changes
  • t:deps - Dependency updates
  • t:breaking-change - Breaking changes
  • t:misc - Miscellaneous (catch-all)

⏰ Reminders before review

  • Contributor guidelines followed
  • All formatters and local linters executed and passed
  • Written new unit and / or integration tests where applicable
  • Protected functional changes with optionality (feature flags)
  • Used internationalization (i18n) for all UI strings
  • CI builds passed
  • Communicated to DevOps any deployment requirements
  • Updated any necessary documentation (Confluence, contributing docs) or informed the documentation team

🦮 Reviewer guidelines

  • 👍 (:+1:) or similar for great changes
  • 📝 (:memo:) or ℹ️ (:information_source:) for notes or general info
  • ❓ (:question:) for questions
  • 🤔 (:thinking:) or 💭 (:thought_balloon:) for more open inquiry that's not quite a confirmed issue and could potentially benefit from discussion
  • 🎨 (:art:) for suggestions / improvements
  • ❌ (:x:) or ⚠️ (:warning:) for more significant problems or concerns needing attention
  • 🌱 (:seedling:) or ♻️ (:recycle:) for future improvements or indications of technical debt
  • ⛏ (:pick:) for minor or nitpick changes

@vvolkgang vvolkgang requested a review from a team as a code owner December 29, 2025 23:26
@github-actions github-actions Bot added the t:ci Change Type - Updates to automated workflows label Dec 29, 2025
@vvolkgang vvolkgang changed the title [PM-22159 ] ci: Add automated PR labelling based on file paths and title patterns [PM-22159] ci: Add automated PR labelling based on file paths and title patterns Dec 29, 2025
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Dec 29, 2025

Logo
Checkmarx One – Scan Summary & Detailsb9e42b0f-080e-4547-b6f6-324f3de8f728

Great job! No new security vulnerabilities introduced in this pull request

@codecov
Copy link
Copy Markdown

codecov Bot commented Dec 29, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 84.27%. Comparing base (5d9e92d) to head (3fe7646).
⚠️ Report is 16 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2225      +/-   ##
==========================================
- Coverage   85.47%   84.27%   -1.20%     
==========================================
  Files        1746     1989     +243     
  Lines      147479   163714   +16235     
==========================================
+ Hits       126055   137973   +11918     
- Misses      21424    25741    +4317     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@vvolkgang vvolkgang added the ai-review Request a Claude code review label Dec 30, 2025
@claude
Copy link
Copy Markdown
Contributor

claude Bot commented Dec 30, 2025

Claude finished @vvolkgang's task in 4m 26s —— View job


Overall Assessment: APPROVE ✅

This PR adds automated PR labeling based on file paths and title patterns, implementing a Python script with GitHub Actions workflow. The implementation follows established patterns from the Android repository with appropriate adaptations for the iOS codebase structure.

Code Review Details

Security:

  • ✅ Proper subprocess usage (list form, no shell injection risk)
  • ✅ Appropriate permission scoping (pull-requests: write, contents: read)
  • ✅ Token handling via environment variables (no exposure risk)

Correctness:

  • ✅ Configuration paths accurately match iOS repository structure
  • ✅ Intentional error handling strategy (fail-fast for writes, graceful for reads)
  • ✅ Workflow parameter handling (parse_known_args for empty string edge case)
  • ✅ Label logic correctly converts app:shared to both PM and Auth labels

Configuration:

  • ✅ All directory paths in label-pr.json exist in the codebase
  • ✅ All referenced .yml files are present
  • release.yml label references use OR logic correctly (multiple labels per category)

Maintainability:

  • ✅ Clear documentation in script docstrings
  • ✅ Validation logic for config file structure
  • ✅ Workflow supports both automated and manual dispatch modes

No findings to report.


Test Recommendations:

  1. Test with workflow_dispatch before enabling pull_request trigger (as noted in Android PR)
  2. Verify labels are created in the repository before first run:
    • app:password-manager, app:authenticator
    • t:feature-app, t:feature-tool, t:bug, t:tech-debt, t:docs, t:ci, t:deps, t:breaking-change, t:misc
  3. Test edge cases:
    • PR with no matching file paths (should get t:misc)
    • PR with no matching title pattern (should get t:misc)
    • Bot PR (Renovate/bw-ghapp) - should use --add mode
    • Fork PR - should use --add mode

Clean implementation that maintains consistency with the Android repository while properly adapting to iOS codebase structure. Ready to merge after testing.

Comment thread .github/label-pr.json Outdated
"t:feature-tool": [
"TestHarness/",
"TestHarnessShared/",
"project-bwth.yml"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤔 Should this include swiftgen-bwth.yml as well?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added!

Comment thread .github/label-pr.json
"GlobalTestHelpers-bwa/",
"GlobalTestHelpers-bwth/",
"Sourcery/",
"TestHelpers/",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤔 If we're including test helpers here, should we also include all the tests?

Copy link
Copy Markdown
Member Author

@vvolkgang vvolkgang Jan 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wasn't sure about it honestly, just wanted to assign most of the top level folders and files to something as a starting point and we can fine-tune later.

@github-actions github-actions Bot removed the ai-review Request a Claude code review label Jan 9, 2026
@vvolkgang vvolkgang merged commit f54330f into main Jan 12, 2026
23 checks passed
@vvolkgang vvolkgang deleted the vvolkgang/label-prs branch January 12, 2026 15:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

t:ci Change Type - Updates to automated workflows

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants