This is an automated email from the ASF dual-hosted git repository.
xtsong pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/flink-agents.git
The following commit(s) were added to refs/heads/main by this push:
new 6aa9f433 [hotfix] Fix issue with the Pull Request Labeler not finding
closed PRs (#615)
6aa9f433 is described below
commit 6aa9f433cf38fa994f8ab75af13661e398177742
Author: Eugene <[email protected]>
AuthorDate: Wed Apr 8 15:43:52 2026 +0800
[hotfix] Fix issue with the Pull Request Labeler not finding closed PRs
(#615)
---
.github/workflows/pr_labeler.js | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/.github/workflows/pr_labeler.js b/.github/workflows/pr_labeler.js
index 0f9dc5ff..fbd69471 100644
--- a/.github/workflows/pr_labeler.js
+++ b/.github/workflows/pr_labeler.js
@@ -27,10 +27,11 @@ module.exports = async ({ github, context, core,
workflowRunId, triggerWorkflow
// Fallback for fork PRs: pull_requests is empty for cross-repo workflow runs
if (!prNumber) {
core.info(`No PR in pull_requests array, falling back to search by head
branch...`);
+ // Search all PRs (including closed) to avoid errors when editing closed
PRs
const { data: pullRequests } = await github.rest.pulls.list({
owner: context.repo.owner,
repo: context.repo.repo,
- state: 'open',
+ state: 'all',
head: `${run.head_repository.owner.login}:${run.head_branch}`,
});
prNumber = pullRequests[0]?.number;
@@ -48,6 +49,12 @@ module.exports = async ({ github, context, core,
workflowRunId, triggerWorkflow
pull_number: prNumber,
});
+ // Skip labeling for closed/merged PRs — editing them should not trigger
label changes
+ if (pr.state !== 'open') {
+ core.info(`PR #${prNumber} is ${pr.state}, skipping labeling.`);
+ return;
+ }
+
const isOpenTrigger = triggerWorkflow === 'PR-Open-Trigger';
const labels = [];