fix: stop persisting the editor configuration in localStorage #1840
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: Validate PR | |
| on: | |
| pull_request: | |
| types: [opened, edited, synchronize, labeled, unlabeled] | |
| jobs: | |
| validate: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| pull-requests: read | |
| steps: | |
| - name: Ensure PR has a valid type | |
| uses: actions/github-script@v7 | |
| with: | |
| script: | | |
| const title = context.payload.pull_request.title; | |
| const prefixMatch = title.match(/^(\w+)(?:\([^)]*\))?(!)?:/); | |
| const prefix = prefixMatch?.[1]?.toLowerCase(); | |
| const validPrefixes = [ | |
| 'feat', 'fix', 'perf', 'test', 'docs', | |
| 'build', 'ci', 'refactor', 'task', 'chore', 'style', | |
| ]; | |
| const hasValidPrefix = validPrefixes.includes(prefix); | |
| const { data: labels } = await github.rest.issues.listLabelsOnIssue({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: context.payload.pull_request.number, | |
| }); | |
| const typeLabels = [ | |
| '[Type] Enhancement', | |
| '[Type] Bug', | |
| '[Type] Performance', | |
| '[Type] Automated Testing', | |
| '[Type] Developer Documentation', | |
| '[Type] Build Tooling', | |
| '[Type] Task', | |
| '[Type] Breaking Change', | |
| '[Type] Regression', | |
| ]; | |
| const hasTypeLabel = labels.some((l) => typeLabels.includes(l.name)); | |
| if (hasValidPrefix || hasTypeLabel) { | |
| const method = hasValidPrefix ? 'Conventional Commits prefix' : 'type label'; | |
| core.info(`✅ PR has a valid type via ${method}`); | |
| return; | |
| } | |
| core.setFailed( | |
| 'PR must have either a Conventional Commits title prefix (e.g. feat:, fix:, docs:) ' + | |
| 'or a [Type] label applied manually.\n\n' + | |
| 'See docs/code/developer-workflows.md for details.' | |
| ); |