labeler_issue.yml 936 B

1234567891011121314151617181920212223242526272829303132
  1. name: "labeler: issue"
  2. on:
  3. issues:
  4. types: [opened]
  5. jobs:
  6. labeler:
  7. permissions:
  8. issues: write
  9. runs-on: ubuntu-latest
  10. steps:
  11. - name: check issue title
  12. uses: actions/github-script@v7
  13. with:
  14. script: |
  15. const title = context.payload.issue.title;
  16. const titleSplit = title.split(/\b/).map(e => e.toLowerCase());
  17. const keywords = ['api', 'treesitter', 'ui', 'lsp'];
  18. var match = new Set();
  19. for (const keyword of keywords) {
  20. if (titleSplit.includes(keyword)) {
  21. match.add(keyword)
  22. }
  23. }
  24. if (match.size !== 0) {
  25. github.rest.issues.addLabels({
  26. owner: context.repo.owner,
  27. repo: context.repo.repo,
  28. issue_number: context.issue.number,
  29. labels: Array.from(match)
  30. })
  31. }