You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@grails.apache.org by jd...@apache.org on 2026/10/01 06:47:01 UTC
(grails-core) branch ci/pr-autolabeler created (now 0f79da388e)
This is an automated email from the ASF dual-hosted git repository.
jdaugherty pushed a change to branch ci/pr-autolabeler
in repository https://gitbox.apache.org/repos/asf/grails-core.git
at 0f79da388e Label pull requests with release-drafter's autolabeler action
This branch includes the following new commits:
new 0f79da388e Label pull requests with release-drafter's autolabeler action
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
(grails-core) 01/01: Label pull requests with release-drafter's autolabeler action
Posted by jd...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
jdaugherty pushed a commit to branch ci/pr-autolabeler
in repository https://gitbox.apache.org/repos/asf/grails-core.git
commit 0f79da388e5c3683c6e28290e329a369c0b94c45
Author: James Daugherty <jd...@jdresources.net>
AuthorDate: Thu Oct 1 02:19:37 2026 -0400
Label pull requests with release-drafter's autolabeler action
release-drafter 7 moved labelling out of the drafter action into a second entrypoint,
release-drafter/release-drafter/autolabeler, so no pull request has been labelled since the
bump to 7 in March and the release notes have lost their categories. This runs that entrypoint
in a workflow of its own, pinned to the same SHA as the drafter so the two are bumped together.
It runs on pull_request, since the ASF restricts pull_request_target. On a pull request from a
fork, about a third of them, the token is therefore read only and cannot add labels; those run
in the action's dry-run mode so the check stays green, and a second step writes the labels the
action chose to the run summary with the command a maintainer runs to add them. It only labels,
never writes a draft, so it cannot touch a release and needs none of the drafter's hold-off.
The title matchers in the autolabeler config were unanchored substrings, which the dry run
showed labelling a fix with `test` and `maintenance` because its title contained the word
"test", and a chore with `bug` because its title contained "fix". They now match a conventional
commit prefix - `fix:`, `fix(scope):`, `fix!:` - and the branch matchers are unchanged.
Needs release-drafter/release-drafter/autolabeler on the ASF allow list first; the drafter's own
entry does not cover the subpath, and validateActions fails on this file until it is added.
---
.github/release-drafter.yml | 28 +++++------
.github/workflows/pr-labeler.yml | 101 +++++++++++++++++++++++++++++++++++++++
2 files changed, 115 insertions(+), 14 deletions(-)
diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml
index eefa8f3ff6..71dca54607 100644
--- a/.github/release-drafter.yml
+++ b/.github/release-drafter.yml
@@ -25,72 +25,72 @@ autolabeler:
branch:
- '/fix\/.+/'
title:
- - '/fix/i'
+ - '/^fix(\(.+\))?!?:/i'
- label: 'improvement'
branch:
- '/improv\/.+/'
title:
- - '/improv/i'
+ - '/^improv(e|ement)?(\(.+\))?!?:/i'
- label: 'feature'
branch:
- '/feature\/.+/'
title:
- - '/feat/i'
+ - '/^feat(ure)?(\(.+\))?!?:/i'
- label: 'documentation'
branch:
- '/docs\/.+/'
title:
- - '/docs/i'
+ - '/^docs?(\(.+\))?!?:/i'
- label: 'maintenance'
branch:
- '/(chore|refactor|style|test|ci|perf|build)\/.+/'
title:
- - '/(chore|refactor|style|test|ci|perf|build)/i'
+ - '/^(chore|refactor|style|test|ci|perf|build)(\(.+\))?!?:/i'
- label: 'chore'
branch:
- '/chore\/.+/'
title:
- - '/chore/i'
+ - '/^chore(\(.+\))?!?:/i'
- label: 'refactor'
branch:
- '/refactor\/.+/'
title:
- - '/refactor/i'
+ - '/^refactor(\(.+\))?!?:/i'
- label: 'style'
branch:
- '/style\/.+/'
title:
- - '/style/i'
+ - '/^style(\(.+\))?!?:/i'
- label: 'test'
branch:
- '/test\/.+/'
title:
- - '/test/i'
+ - '/^test(\(.+\))?!?:/i'
- label: 'ci'
branch:
- '/ci\/.+/'
title:
- - '/ci/i'
+ - '/^ci(\(.+\))?!?:/i'
- label: 'perf'
branch:
- '/perf\/.+/'
title:
- - '/perf/i'
+ - '/^perf(\(.+\))?!?:/i'
- label: 'build'
branch:
- '/build\/.+/'
title:
- - '/build/i'
+ - '/^build(\(.+\))?!?:/i'
- label: 'deps'
branch:
- '/deps\/.+/'
title:
- - '/deps/i'
+ - '/^deps(\(.+\))?!?:/i'
- label: 'revert'
branch:
- '/revert\/.+/'
title:
- - '/revert/i'
+ - '/^revert(\(.+\))?!?:/i'
categories:
- title: '🚀 Features'
labels:
diff --git a/.github/workflows/pr-labeler.yml b/.github/workflows/pr-labeler.yml
new file mode 100644
index 0000000000..308e0026e7
--- /dev/null
+++ b/.github/workflows/pr-labeler.yml
@@ -0,0 +1,101 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# Labels pull requests from their branch name and title, using the
+# `autolabeler` section of .github/release-drafter.yml. The labels feed the
+# categories in the release notes that .github/workflows/release-notes.yml
+# drafts, so a pull request without one lands uncategorised.
+#
+# This used to be done by the drafter workflow itself. release-drafter 7 moved
+# labelling into a second action, `release-drafter/release-drafter/autolabeler`,
+# and the drafter action no longer labels anything, so this is a workflow of
+# its own. It only labels: it never writes a draft, so it cannot touch a
+# release and needs none of the drafter's release-pipeline hold-off.
+#
+# Companion config: .github/release-drafter.yml (`autolabeler:`)
+name: "Pull Request - Labeler"
+on:
+ # `pull_request`, not `pull_request_target`: the ASF restricts the latter.
+ # The cost is pull requests from forks, about a third of them: on a fork's
+ # `pull_request` event the token is read only and cannot add labels. Those
+ # run in the action's dry-run mode instead, so the check stays green and the
+ # run reports the labels a maintainer then adds by hand.
+ #
+ # `labeled` is deliberately not listed - the run would re-trigger itself.
+ # `edited` re-evaluates a retitled pull request.
+ pull_request:
+ types: [opened, reopened, synchronize, edited]
+
+# One run per pull request; a newer event for the same pull request supersedes
+# an older one. Keyed on the number so pull requests never share a group.
+concurrency:
+ group: pr-labeler-${{ github.event.pull_request.number }}
+ cancel-in-progress: true
+
+permissions: {}
+
+jobs:
+ label:
+ name: "Label Pull Request"
+ permissions:
+ # Required to read .github/release-drafter.yml through the API
+ contents: read
+ # Required to add labels. GitHub downgrades the token to read only on a
+ # pull request from a fork regardless of what is asked for here.
+ pull-requests: write
+ runs-on: ubuntu-latest
+ env:
+ # True when the head branch lives in another repository, i.e. a fork.
+ FORK: ${{ github.event.pull_request.head.repo.full_name != github.repository }}
+ steps:
+ # The autolabeler entrypoint of the same action the drafter uses, pinned
+ # to the same SHA; bump both together. Resolve the commit SHA via:
+ # gh api repos/release-drafter/release-drafter/git/tags/<tag-sha> \
+ # --jq '.object.sha'
+ - name: "🏷️ Apply labels"
+ id: labeler
+ uses: release-drafter/release-drafter/autolabeler@34d80673e067bdc0c24568d3af899c216adcfaa9 # v7.7.0
+ with:
+ # Fork pull requests: compute and report, do not write (see above).
+ dry-run: ${{ env.FORK }}
+ env:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+
+ # The action exposes the labels it chose as an output. For a fork pull
+ # request nothing was written, so say what a maintainer needs to add.
+ - name: "📋 Report labels for a fork pull request"
+ if: env.FORK == 'true'
+ env:
+ LABELS: ${{ steps.labeler.outputs.labels }}
+ NUMBER: ${{ github.event.pull_request.number }}
+ run: |
+ set -euo pipefail
+ {
+ echo "## Pull Request Labeler"
+ echo ""
+ echo "This pull request comes from a fork, so the token is read only and no labels were written."
+ if [[ -n "${LABELS:-}" ]]; then
+ echo ""
+ echo "A maintainer should add: \`${LABELS}\`"
+ echo ""
+ echo '```'
+ echo "gh pr edit ${NUMBER} --add-label '${LABELS}'"
+ echo '```'
+ else
+ echo ""
+ echo "No label matched the branch name or title."
+ fi
+ } >> "$GITHUB_STEP_SUMMARY"
+ echo "::notice title=Labels not written (fork)::${LABELS:-none matched}; a maintainer needs to add them."