Skip to content

Adding release labels for merged PRs - #98

Open
ahus1 wants to merge 1 commit into
keycloak:mainfrom
ahus1:is-97-add-release-labels
Open

ahus1 wants to merge 1 commit into
keycloak:mainfrom
ahus1:is-97-add-release-labels

Conversation

@ahus1

@ahus1 ahus1 commented Nov 9, 2026 •

Copy link
Copy Markdown
Member

Closes #97

Replaces the labeller workflow of keycloak/keycloak that relied on pull_request_target, which GitHub is phasing out.

Decisions and assumptions:

  • The label is derived from the target branch: a PR merged into main gets the next minor after the highest release/X.Y branch, a PR merged into release/X.Y gets the next micro after the highest X.Y.* tag.
  • 26.9.0 is mapped to 27.0.0, as there will be no more 26.x minor release after 26.8.
  • Issues are taken from the PR description, falling back to the merge commit message, using the same parser as the backport linking; references to other repositories are ignored.
  • Referenced pull requests and missing issues are skipped, the remaining issues are still labeled.
  • The backport/ label of the target branch is removed, other backport/ labels stay.
  • The release/ label is created with the color used in keycloak/keycloak if it doesn't exist yet.
  • The app needs the Pull request event, plus read access to pull requests and contents, and write access to issues.

Tested with a test GitHub App on a fork, each scenario creating a new release/ label:

@ahus1 ahus1 self-assigned this Nov 9, 2026
@ahus1
ahus1 force-pushed the is-97-add-release-labels branch from b11aa74 to 3274639 Compare November 13, 2026 15:19
@ahus1
ahus1 requested a balanced review from Copilot November 13, 2026 15:21

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

Release-labeling bugs can misparse references, modify pull requests instead of issues, and abort valid issue updates when references are missing or label creation races.

5 open issues
What changed in this PR

Moves merged-PR release labeling into the bot, replacing the workflow that relied on pull_request_target and addressing #97.

Changes:

  • Derives release labels from target branches and tags, including the 26.9.0 → 27.0.0 mapping.
  • Labels same-repository issues referenced in the PR description or merge commit and removes the target branch’s backport label.
  • Adds utility tests and documents the new behavior.
File Description
src/​test/​java/​org/​keycloak/​gh/​bot/​utils/​ReleaseLabelsTest.java Tests version selection and issue-reference parsing.
src/​main/​java/​org/​keycloak/​gh/​bot/​utils/​ReleaseLabels.java Calculates release labels and extracts issue references.
src/​main/​java/​org/​keycloak/​gh/​bot/​utils/​Labels.java Exposes repository label-existence checks.
src/​main/​java/​org/​keycloak/​gh/​bot/​AddReleaseLabelOnMerge.java Handles merged PRs and updates issue labels.
README.md Documents release labeling on merge.

Review effort: Balanced

@ahus1
ahus1 force-pushed the is-97-add-release-labels branch from 3274639 to e96940f Compare November 13, 2026 15:40
@ahus1
ahus1 requested a balanced review from Copilot November 13, 2026 15:40

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

An unnecessary merge-commit fetch adds a GitHub API request and makes labeling depend on its success even when the PR description already contains closing references.

1 open issue
5 resolved since last review

Review effort: Balanced

@ahus1
ahus1 force-pushed the is-97-add-release-labels branch 2 times, most recently from 4f8de93 to b2d7ee7 Compare November 13, 2026 15:48
Closes keycloak#97

Signed-off-by: Alexander Schwartz <alexander.schwartz@ibm.com>
@ahus1
ahus1 force-pushed the is-97-add-release-labels branch from b2d7ee7 to c830380 Compare November 13, 2026 15:49
@ahus1
ahus1 requested a balanced review from Copilot November 13, 2026 15:50

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.

🟢 Approval recommended

No active review issues remain for the release-labeling change.

No open issues 🎉

1 resolved since last review

Review effort: Balanced

@ahus1
ahus1 marked this pull request as ready for review November 13, 2026 15:52
@ahus1
ahus1 requested a review from stianst November 13, 2026 15:53
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.

Replacement for pull_request_target triggers

2 participants