Skip to content

[#2905] chore: replace labeler with the one that works like magpie and pull_r… #775

[#2905] chore: replace labeler with the one that works like magpie and pull_r…

[#2905] chore: replace labeler with the one that works like magpie and pull_r… #775

Workflow file for this run

# Licensed to the Apache Software Foundation (ASF) under one

Check warning on line 1 in .github/workflows/labeler.yml

View workflow run for this annotation

GitHub Actions / Pull Request Labeler

Workflow execution policy warning (evaluate mode)

On November 2, 2026, GitHub will restrict `pull_request_target` on public repositories by default. To continue allowing the event trigger, configure an Actions policy. Learn more: https://gh.io/securely-using-pull_request_target#default-policy-for-pull_request_target
# 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
#
# http://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.
---
name: Pull Request Labeler
"on":
workflow_run: # zizmor: ignore[dangerous-triggers] -- no PR code is checked out or executed
workflows: ["Pull Request Labeler Signal"]
types: [completed]
permissions: { }
jobs:
triage:
if: github.event.workflow_run.event == 'pull_request'
permissions:
contents: read
pull-requests: write
runs-on: ubuntu-latest
steps:
- name: Find pull request
id: pr
env:
GH_TOKEN: ${{ github.token }}
REPO: ${{ github.repository }}
HEAD_SHA: ${{ github.event.workflow_run.head_sha }}
run: |
set -euo pipefail
if ! [[ "$HEAD_SHA" =~ ^[0-9a-f]{40}$ ]]; then
echo "::error::Unexpected pull request head SHA"
exit 1
fi
pr_numbers=$(gh api "repos/$REPO/commits/$HEAD_SHA/pulls" \
--jq '.[] | select(.state == "open") | .number')
{
echo "numbers<<EOF"
printf '%s\n' "$pr_numbers"
echo "EOF"
} >> "$GITHUB_OUTPUT"
- uses: actions/labeler@bf12e9b00b37c5c0ca2b87b79b2daf7891dbda13 # v7.0.0
if: steps.pr.outputs.numbers != ''
with:
repo-token: '${{ secrets.GITHUB_TOKEN }}'
pr-number: ${{ steps.pr.outputs.numbers }}
sync-labels: true