Improve Zappa/Terraform Migration #788
This file contains hidden or 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
| name: Auto Label Issues | |
| on: | |
| issues: | |
| types: | |
| - edited | |
| - opened | |
| permissions: | |
| issues: write | |
| jobs: | |
| label: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Apply Labels to Issues | |
| uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd | |
| with: | |
| script: | | |
| const issue = context.payload.issue; | |
| if (!issue || (!issue.title && !issue.body)) return; | |
| const title = issue.title?.toLowerCase() || ""; | |
| const body = issue.body?.toLowerCase() || ""; | |
| const keywordMapping = { | |
| "bug": ["error", "failure", "not working", "crash", "unexpected"], | |
| "enhancement": ["add", "feature request", "improve", "suggestion"], | |
| "question": ["clarification", "help", "how to", "guidance"] | |
| }; | |
| const labels = Object.entries(keywordMapping) | |
| .filter(([_, words]) => words.some(word => title.includes(word) || body.includes(word))) | |
| .map(([label, _]) => label); | |
| if (labels.length > 0) { | |
| github.rest.issues.addLabels({ | |
| issue_number: context.issue.number, | |
| labels: labels, | |
| owner: context.repo.owner, | |
| repo: context.repo.repo | |
| }); | |
| } |