From 715cfc8ebd70296d9b25aa866a82f8b0bf2231f2 Mon Sep 17 00:00:00 2001 From: Ankio Date: Wed, 10 Apr 2024 16:52:03 +0800 Subject: [PATCH] =?UTF-8?q?:sparkles:=20=E5=A2=9E=E5=8A=A0=E6=98=AF?= =?UTF-8?q?=E5=90=A6=E5=85=B3=E9=97=AD=E7=9A=84=E6=A3=80=E6=B5=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/issue-commit.yml | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/.github/workflows/issue-commit.yml b/.github/workflows/issue-commit.yml index a061672..0d9bcc0 100644 --- a/.github/workflows/issue-commit.yml +++ b/.github/workflows/issue-commit.yml @@ -27,12 +27,21 @@ jobs: console.log(`Found issue reference in commit: ${match[0]}`); const issueNumber = parseInt(match[1]); console.log(`Issue number: ${issueNumber}`); - await github.rest.issues.update({ + const issue = await github.rest.issues.get({ owner: context.repo.owner, repo: context.repo.repo, - issue_number: issueNumber, - state: "closed" + issue_number: issueNumber }); - console.log(`Issue ${issueNumber} closed`); + if (issue.data.state !== 'closed') { + await github.rest.issues.update({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: issueNumber, + state: "closed" + }); + console.log(`Issue ${issueNumber} closed`); + } else { + console.log(`Issue ${issueNumber} is already closed`); + } } }