Follow-up: frontend provider settings and cost UI for multi-provider runtime #1
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: Issue Auto Label | |
| on: | |
| issues: | |
| types: [opened] | |
| jobs: | |
| label-area: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| issues: write | |
| steps: | |
| - name: Add area label from form | |
| uses: actions/github-script@v9 | |
| with: | |
| script: | | |
| const issue = context.payload.issue; | |
| const body = issue.body || ''; | |
| console.log(`Processing issue #${issue.number}: ${issue.title}`); | |
| // Map form selection to label | |
| const areaMap = { | |
| 'Frontend': 'area/frontend', | |
| 'Backend': 'area/backend', | |
| 'Fullstack': 'area/fullstack' | |
| }; | |
| const labels = []; | |
| for (const [key, label] of Object.entries(areaMap)) { | |
| if (body.includes(key)) { | |
| console.log(`Found area: ${key}, adding label: ${label}`); | |
| labels.push(label); | |
| break; | |
| } | |
| } | |
| if (labels.length > 0) { | |
| try { | |
| await github.rest.issues.addLabels({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: issue.number, | |
| labels: labels | |
| }); | |
| console.log(`Successfully added labels: ${labels.join(', ')}`); | |
| } catch (error) { | |
| core.setFailed(`Failed to add labels: ${error.message}`); | |
| } | |
| } else { | |
| console.log('No matching area found in issue body'); | |
| } |