Skip to content

Commit

Permalink
fix git action
Browse files Browse the repository at this point in the history
  • Loading branch information
kira1928 committed Jun 2, 2024
1 parent c4bbc6e commit 2b2ed6d
Showing 1 changed file with 10 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,23 +38,24 @@ jobs:
uses: actions/github-script@v6
with:
script: |
const issue = context.issue;
const body = context.payload.issue.body;
const body = github.event.issue.body;
const versionRegex = /### 程序版本\s*(.+)\s*### 所使用的/;
const versionMatch = body.match(versionRegex);
let closeReasons = [];
if (!versionMatch || !versionMatch[1].match(/\d+/)) {
closeReasons.push('请填入有效的程序版本。');
}
if (closeReasons.length > 0) {
const newComment = context.issue({
body: `Issue 未通过验证:\n${closeReasons.join('\n')}`
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
body: `Issue 未通过验证:\n${closeReasons.join('\n')}`,
});
await github.issues.createComment(newComment);
await github.issues.update({
owner: issue.owner,
repo: issue.repo,
issue_number: issue.number,
await github.rest.issues.update({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
state: 'closed'
});
}
Expand Down

0 comments on commit 2b2ed6d

Please sign in to comment.