Issue Labeler for Dropdown #19
This file contains 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: Issue Labeler for Dropdown | |
on: | |
issues: | |
types: [opened] | |
jobs: | |
label: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/github-script@v7 | |
with: | |
script: | | |
const issueBody = context.payload.issue.body; | |
const shfwLabel = 'shfw'; | |
const shutLabel = 'shut'; | |
const criticalLabel = 'critical'; | |
const highLabel = 'high'; | |
const mediumLabel = 'medium'; | |
const lowLabel = 'low'; | |
let labelsToAdd = []; | |
if (issueBody.includes('Firmware (SHFW)')) { | |
labelsToAdd.push(shfwLabel); | |
} else if (issueBody.includes('Utility (SHUT)')) { | |
labelsToAdd.push(shutLabel); | |
} else if (issueBody.includes('low (asthetic, minor issue)')) { | |
labelsToAdd.push(lowLabel); | |
} else if (issueBody.includes('medium (affects usability but has a workaround)')) { | |
labelsToAdd.push(mediumLabel); | |
} else if (issueBody.includes('high (major functionality broken, no workaround)')) { | |
labelsToAdd.push(highLabel); | |
} else if (issueBody.includes('critical (app crash, data loss)')) { | |
labelsToAdd.push(criticalLabel); | |
} else if (issueBody.includes('low (take your time)')) { | |
labelsToAdd.push(lowLabel); | |
} else if (issueBody.includes('medium (upcoming releases)')) { | |
labelsToAdd.push(mediumLabel); | |
} else if (issueBody.includes('high (definitely next release)')) { | |
labelsToAdd.push(highLabel); | |
if (labelsToAdd.length > 0) { | |
github.rest.issues.addLabels({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
issue_number: context.payload.issue.number, | |
labels: labelsToAdd | |
}); | |
} |