8000 Add a pull request labeler workflow by paulinevos · Pull Request #91 · doctrine/.github · GitHub
[go: up one dir, main page]

Skip to content

Add a pull request labeler workflow - #91

Open
paulinevos wants to merge 1 commit into
mainfrom
add-label-pull-request
Open

paulinevos wants to merge 1 commit into
mainfrom
add-label-pull-request

Conversation

@paulinevos
@paulinevos paulinevos commented Nov 6, 2026 •
Copy link
Copy Markdown
Member

Adds the pull request labeler as a reusable workflow + workflow template, following the same pattern as the target branch check — and combining the two so they run in the right order.

The combined workflow:

  1. Label — the Label Classifier action (paulinevos/label-classifier@v1) suggests labels for a newly opened pull request by answering per-label policy questions against its context (title, description, commits, changed files, diff, base-revision documentation), applies the suggestion by adding labels only — existing labels are preserved — and posts one comment noting the labels were applied automatically from AI suggestions and should be checked by a human.
  2. Check — the existing target branch check runs as a second job (needs: label), so an automatically applied label cannot miss its check. On reopened/labeled/unlabeled/edited events only the check runs — this template replaces the standalone check-target-branch template for repositories that adopt it; repositories that keep the standalone template are unaffected (refs are pinned per repository).

Requirements for consuming repositories:

  • the JEV_API_KEY secret, and optionally the JEV_ENDPOINT variable if the key is issued by a gateway other than Typesafe;
  • issues: write and pull-requests: write permissions (as in the template).

Safety: pull_request_target so fork pull requests are labeled too; the action never checks out or executes the pull request head — it only reads the event payload and runs its own pinned code.

Ref strategy: the template pins use_a_valid_ref_here per convention; the action is consumed by the floating v1 tag — flag it if Doctrine policy requires commit-SHA pinning instead.

Copilot AI balanced review requested due to automatic review settings November 6, 2026 13:31
Copilot AI left a comment
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

The workflow fails before suggesting labels because GITHUB_TOKEN is missing, and its undeclared JEV_API_KEY secret causes validation failures for callers using explicit secret mappings.

2 open issues
What changed in this PR

Adds a reusable pull request labeling workflow and a matching template for consuming repositories, following the existing target-branch-check pattern.

Changes:

  • Integrates the Label Classifier action with configurable apply, model, and endpoint inputs.
  • Adds a template triggered when pull requests open, including fork pull requests, with write permissions and inherited secrets.
  • Registers the template with a description, icon, and PHP category.
File Description
workflow-templates/​label-pull-request.yml Calls the reusable workflow on pull request creation.
workflow-templates/​label-pull-request.properties.json Provides workflow template metadata.
.github/​workflows/​label-pull-request.yml Defines the reusable workflow and classifier integration.

Review effort: Balanced

@paulinevos
Copy link
Copy Markdown
Member Author

Tested successfully here: doctrine/orm#12756

Although the classifier just missed the threshold for CI label at 0.78 😅. I'm inclined to keep it at 0.8 though cause in most cases it will apply correctly and I think under applying slightly is preferable to over applying (but lmk if you disagree)

@paulinevos
paulinevos marked this pull request as ready for review November 6, 2026 14:01
Copilot AI left a comment
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

Automatic BC Break labels can escape target-branch validation because github.token label changes do not trigger the check, while contributor comments can suppress the promised human-review notice.

1 open issue
1 previously missed issue

In code that hasn't changed since last review

Medium severity Restrict disclosure-comment suppression to the bot's exact notice marker

.github/​workflows/​label-pull-request.yml:43

The v1 action skips its disclosure comment whenever any existing PR comment contains label-classifier, regardless of author or whether it is an automatic-label notice. A contributor can therefore suppress the promised human-review notice simply by mentioning that string before the action reaches the comment step. Consume a revision that checks for an exact, bot-authored notice marker, or handle that check and comment in this workflow.

2 resolved since last review

Review effort: Balanced

@paulinevos
paulinevos force-pushed the add-label-pull-request branch from d478e0a to 03b875b Compare November 6, 2026 14:46
@paulinevos
paulinevos requested review from beberlei and greg0ire and a balanced review from Copilot November 6, 2026 14:46
Copilot AI left a comment
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

Shared concurrency can cancel initial automatic labeling, and manual runs omit the PR number from the branch check, allowing it to succeed without checking the targeted PR.

2 open issues
1 resolved since last review

Review effort: Balanced

name: "Labels match target branch"
needs: label
if: "always() && (github.event.action != 'opened' || inputs.number != '' || needs.label.result != 'skipped')"
uses: ./.github/workflows/check-target-branch.yml
- "edited"

concurrency:
group: "label-pull-request-${{ github.event.pull_request.number }}"
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.

Fixed: opening runs and check-only runs now use separate concurrency lanes (label-pull-request-N and check-target-branch-N, the latter matching the standalone check template). An edit during classification can no longer cancel it.

Consumes the Label Classifier action (paulinevos/label-classifier@v1), which
suggests labels for newly opened pull requests by answering per-label policy
questions against the pull request's context, applies the suggestion by
adding labels only, and comments that the labels were applied automatically
from AI suggestions and should be checked by a human.

The target branch check runs as a second job after labeling, so an
automatically applied label cannot miss its check. On reopened, labeled,
unlabeled, and edited events only the check runs, replacing the standalone
check-target-branch template for repositories that adopt this workflow.

Uses pull_request_target so pull requests from forks are labeled too; safe
because the action never checks out or executes the pull request head.
@paulinevos
paulinevos force-pushed the add-label-pull-request branch from 03b875b to 512db3c Compare November 6, 2026 15:24
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

0