Skip to content

Commit

Permalink
✨ 增加是否关闭的检测
Browse files Browse the repository at this point in the history
  • Loading branch information
AnkioTomas committed Apr 10, 2024
1 parent 6617325 commit 715cfc8
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions .github/workflows/issue-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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`);
}
}
}

0 comments on commit 715cfc8

Please sign in to comment.