适配请求:com.eg.android.AlipayGphone #7
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
on: | |
issues: | |
types: | |
- opened | |
- reopened | |
jobs: | |
extract_label: | |
runs-on: ubuntu-latest | |
permissions: | |
issues: write | |
steps: | |
- name: Extract Label and Title | |
uses: actions/github-script@v6 | |
with: | |
script: | | |
const issueTitle = context.payload.issue.title; | |
const regexResult = issueTitle.match(/\[(.*?)\]\[(.*?)\](.*)/); | |
if (regexResult && regexResult.length >= 4) { | |
github.rest.issues.addLabels({ | |
issue_number: context.issue.number, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
labels: [regexResult[1], regexResult[2], regexResult[3]] | |
}); | |
github.rest.issues.update({ | |
issue_number: context.issue.number, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
title: "适配请求:"+regexResult[3] | |
}); | |
} else { | |
// Add a comment to the issue | |
github.rest.issues.createComment({ | |
issue_number: context.issue.number, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
body: "错误的 issue 名称格式,请按指定格式输入。" | |
}); | |
// Close the issue and label it as 'invalid' | |
github.rest.issues.update({ | |
issue_number: context.issue.number, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
state: 'closed', | |
labels: ['invalid'] | |
}); | |
} |