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
|
2023-11-14 21:57:54 -07:00
|
|
|
uses: actions/github-script@v7
|
2023-05-07 05:55:31 -07:00
|
|
|
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)
|
|
|
|
})
|
|
|
|
}
|