2023-05-07 05:55:31 -07:00
|
|
|
name: Issue Open Check
|
|
|
|
|
|
|
|
on:
|
|
|
|
issues:
|
|
|
|
types: [opened]
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
issue-open-check:
|
|
|
|
permissions:
|
|
|
|
issues: write
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: check issue title
|
|
|
|
id: check-issue
|
|
|
|
uses: actions/github-script@v6
|
|
|
|
with:
|
|
|
|
script: |
|
|
|
|
const title = context.payload.issue.title;
|
|
|
|
const titleSplit = title.split(/\s+/).map(e => e.toLowerCase());
|
2023-05-30 17:54:35 -07:00
|
|
|
const keywords = ['api', 'treesitter', 'ui', 'lsp'];
|
2023-05-07 05:55:31 -07:00
|
|
|
var match = new Set();
|
2023-05-30 17:54:35 -07:00
|
|
|
for (const keyword of keywords) {
|
|
|
|
if (titleSplit.includes(keyword)) {
|
2023-05-07 05:55:31 -07:00
|
|
|
match.add(keyword)
|
|
|
|
}
|
|
|
|
}
|
2023-05-30 17:54:35 -07:00
|
|
|
if (match.size !== 0) {
|
2023-05-07 05:55:31 -07:00
|
|
|
github.rest.issues.addLabels({
|
|
|
|
owner: context.repo.owner,
|
|
|
|
repo: context.repo.repo,
|
|
|
|
issue_number: context.issue.number,
|
|
|
|
labels: Array.from(match)
|
|
|
|
})
|
|
|
|
}
|