Skip to content

Add reusable PR auto-labeler workflow#76

Open
pratikmankawde wants to merge 1 commit intoXRPLF:mainfrom
pratikmankawde:pratik/pr-auto-labeler
Open

Add reusable PR auto-labeler workflow#76
pratikmankawde wants to merge 1 commit intoXRPLF:mainfrom
pratikmankawde:pratik/pr-auto-labeler

Conversation

@pratikmankawde
Copy link
Copy Markdown

@pratikmankawde pratikmankawde commented Mar 9, 2026

High Level Overview of Change

Adds a reusable workflow_call workflow that automatically applies/removes GitHub labels based on checked checkboxes in PR descriptions. This pairs with existing PR templates' "Type of Change" sections — no extra effort from contributors, labels stay in sync with the description.

Context of Change

Repos like rippled already have structured PR templates with checkbox fields (Type of Change, API Impact). This workflow parses those checkboxes and maps them to labels, eliminating manual label management.

How it works

  1. Calling repo provides a JSON label_mapping input: {"- \\[x\\] Bug fix": "BugFix", ...}
  2. Workflow regex-matches each pattern against the PR body
  3. Checked boxes -> labels added; unchecked boxes -> labels removed

Example PR with effect: pratikmankawde#1
Try changing the 'type of change' options. The labels change automatically. Might take a-few seconds though.

Type of Change

  • New feature (non-breaking change which adds functionality)

Files

  • pr-auto-labeler.yml — the reusable workflow
  • test-pr-auto-labeler.yml — test workflow with sample rippled mappings

@pratikmankawde pratikmankawde force-pushed the pratik/pr-auto-labeler branch from ec79181 to a2dcdbb Compare March 9, 2026 13:52
@pratikmankawde pratikmankawde changed the title feat: Add reusable PR auto-labeler workflow Add reusable PR auto-labeler workflow Mar 9, 2026
@pratikmankawde pratikmankawde marked this pull request as draft March 9, 2026 14:01
Adds a workflow_call workflow that parses checked checkboxes in PR
descriptions and applies/removes corresponding GitHub labels. Label
mapping is configurable via JSON input so any repo can use its own
PR template fields.

- Passes label_mapping via env var to avoid JS interpolation issues
- Handles 403 gracefully for fork PRs with insufficient permissions
- Includes test workflow with sample rippled-style mappings

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@pratikmankawde pratikmankawde force-pushed the pratik/pr-auto-labeler branch from c04026a to 79d342f Compare March 9, 2026 14:06
@pratikmankawde pratikmankawde marked this pull request as ready for review March 9, 2026 14:06
Copy link
Copy Markdown
Collaborator

@mathbunnyru mathbunnyru left a comment

Choose a reason for hiding this comment

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

This shouldn't be implemented manually.

If we agree to apply custom labels, it should be done via add_label + custom_labels of https://github.com/ytanikin/pr-conventional-commits

And if we decide to go this way, it should be done on top of #73, not as a separate workflow

@pratikmankawde
Copy link
Copy Markdown
Author

This shouldn't be implemented manually.

If we agree to apply custom labels, it should be done via add_label + custom_labels of https://github.com/ytanikin/pr-conventional-commits

And if we decide to go this way, it should be done on top of #73, not as a separate workflow

I believe using ytanikin/pr-conventional-commits, is introducing a new workflow and some more expectation from developers. We can achieve what we want with the existing workflow.

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