auto-label-tui.yml 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. name: Auto-label TUI Issues
  2. on:
  3. issues:
  4. types: [opened]
  5. jobs:
  6. auto-label:
  7. runs-on: ubuntu-latest
  8. permissions:
  9. contents: read
  10. issues: write
  11. steps:
  12. - name: Auto-label and assign issues
  13. uses: actions/github-script@v7
  14. with:
  15. github-token: ${{ secrets.GITHUB_TOKEN }}
  16. script: |
  17. const issue = context.payload.issue;
  18. const title = issue.title;
  19. const description = issue.body || '';
  20. // Check for "opencode web" keyword
  21. const webPattern = /(opencode web)/i;
  22. const isWebRelated = webPattern.test(title) || webPattern.test(description);
  23. // Check for version patterns like v1.0.x or 1.0.x
  24. const versionPattern = /[v]?1\.0\./i;
  25. const isVersionRelated = versionPattern.test(title) || versionPattern.test(description);
  26. // Check for "nix" keyword
  27. const nixPattern = /\bnix\b/i;
  28. const isNixRelated = nixPattern.test(title) || nixPattern.test(description);
  29. const labels = [];
  30. if (isWebRelated) {
  31. labels.push('web');
  32. // Assign to adamdotdevin
  33. await github.rest.issues.addAssignees({
  34. owner: context.repo.owner,
  35. repo: context.repo.repo,
  36. issue_number: issue.number,
  37. assignees: ['adamdotdevin']
  38. });
  39. } else if (isVersionRelated) {
  40. // Only add opentui if NOT web-related
  41. labels.push('opentui');
  42. }
  43. if (isNixRelated) {
  44. labels.push('nix');
  45. }
  46. if (labels.length > 0) {
  47. await github.rest.issues.addLabels({
  48. owner: context.repo.owner,
  49. repo: context.repo.repo,
  50. issue_number: issue.number,
  51. labels: labels
  52. });
  53. }