From 60e9fcc202d22c43c2a7f77d22432ae1743ab0e7 Mon Sep 17 00:00:00 2001 From: peaklabs-dev <122374094+peaklabs-dev@users.noreply.github.com> Date: Thu, 19 Sep 2024 12:55:20 +0200 Subject: [PATCH] Update remove-labels-and-assignees-on-close.yml --- .../remove-labels-and-assignees-on-close.yml | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/.github/workflows/remove-labels-and-assignees-on-close.yml b/.github/workflows/remove-labels-and-assignees-on-close.yml index 04d62623c..b23458ed2 100644 --- a/.github/workflows/remove-labels-and-assignees-on-close.yml +++ b/.github/workflows/remove-labels-and-assignees-on-close.yml @@ -65,11 +65,14 @@ jobs: } if (context.eventName === 'pull_request' || context.eventName === 'pull_request_target') { - const { data: closedIssues } = await github.rest.search.issuesAndPullRequests({ - q: `repo:${owner}/${repo} is:issue is:closed linked:${context.payload.pull_request.number}`, - per_page: 100 - }); - for (const issue of closedIssues.items) { - await processIssue(issue.number); + const pr = context.payload.pull_request; + if (pr.body) { + const issueReferences = pr.body.match(/#(\d+)/g); + if (issueReferences) { + for (const reference of issueReferences) { + const issueNumber = parseInt(reference.substring(1)); + await processIssue(issueNumber); + } + } } }