Add Transmission Distance to "Color Match" search and "Browse By" quickfilters #123
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
# Many thanks to Gina @ Octoprint for this | |
name: "Issue Automation" | |
on: | |
issues: | |
types: [opened, edited, closed, reopened, labeled, unlabeled] | |
jobs: | |
issue-automation: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/github-script@v7 | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
script: | | |
let labels = context.payload.issue.labels.map(label => label.name); | |
let setLabels = false; | |
switch (context.payload.action) { | |
case 'opened': { | |
if ('${{ github.event.pull_request.user.login }}'.match(/dependabot\[bot\]/i)) { | |
labels.push('dependencies'); | |
labels = labels.filter(label => label !== 'triage'); | |
setLabels = true; | |
} | |
break; | |
} | |
case 'edited': { | |
if (context.payload.issue.title.match(/\[request\]|feature request/i)) { | |
labels.push('request'); | |
labels = labels.filter(label => label !== 'triage'); | |
setLabels = true; | |
} | |
if (context.payload.issue.title.match(/\[task\]/i)) { | |
labels.push('task'); | |
labels = labels.filter(label => label !== 'triage'); | |
setLabels = true; | |
} | |
if (labels.length === 0) { | |
labels.push('triage'); | |
setLabels = true; | |
} | |
break; | |
} | |
case 'closed': { | |
if (labels.includes('bug') || labels.includes('request') || labels.includes('improvement') || labels.includes('task')) { | |
labels.push('done'); | |
setLabels = true; | |
} | |
break; | |
} | |
case 'reopened': { | |
if (labels.includes('done')) { | |
labels = labels.filter(label => label !== 'done'); | |
setLabels = true; | |
} | |
break; | |
} | |
} | |
if (setLabels) { | |
github.rest.issues.setLabels({ | |
issue_number: context.issue.number, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
labels: labels | |
}) | |
} |