Repository navigation
fix: route your own tip card to the You tab (deeplink + scan) #982
Workflow file for this run
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: Label PRs | |
| on: | |
| pull_request: | |
| types: [opened, synchronize] | |
| permissions: | |
| contents: read | |
| pull-requests: write | |
| jobs: | |
| area-labels: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/labeler@v5 | |
| with: | |
| sync-labels: false | |
| type-label: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/github-script@v7 | |
| with: | |
| script: | | |
| const title = context.payload.pull_request.title; | |
| const prefixMap = { | |
| 'feat': 'type: feature', | |
| 'fix': 'type: fix', | |
| 'refactor': 'type: refactor', | |
| 'chore': 'type: chore', | |
| 'build': 'type: build', | |
| 'test': 'type: test', | |
| 'docs': 'type: docs', | |
| }; | |
| const match = title.match(/^(\w+)(\(.+\))?[!]?:/); | |
| if (!match) return; | |
| const prefix = match[1]; | |
| const label = prefixMap[prefix]; | |
| if (!label) return; | |
| const { data: labels } = await github.rest.issues.listLabelsOnIssue({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: context.issue.number, | |
| }); | |
| if (labels.some(l => l.name === label)) return; | |
| await github.rest.issues.addLabels({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: context.issue.number, | |
| labels: [label], | |
| }); |