From 54854b412c06ff4bfe146b1953265f69639378c5 Mon Sep 17 00:00:00 2001 From: shenxianpeng Date: Thu, 30 Jul 2026 18:59:49 +0300 Subject: [PATCH] fix: use pull_request_target for auto-labeler on fork PRs When a PR is opened from a fork repository, the GITHUB_TOKEN in pull_request events only has read permissions, preventing the autolabeler from adding labels. Using pull_request_target runs the workflow in the context of the base repository with write permissions, which is safe since the autolabeler only reads PR metadata and adds labels without checking out any code. Fixes auto-labeler failing on PR #487 from a fork. --- .github/workflows/labeler.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/labeler.yml b/.github/workflows/labeler.yml index fdcef892..011cb85d 100644 --- a/.github/workflows/labeler.yml +++ b/.github/workflows/labeler.yml @@ -1,8 +1,8 @@ name: PR Auto-labeler on: - # pull_request event is required for auto-labeler - pull_request: + # pull_request_target event is required for auto-labeler on fork PRs + pull_request_target: types: [opened, reopened, synchronize] permissions: {}