fix: preserve existing config in configure()
#111
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: PR formatting | |
| on: | |
| pull_request_target: | |
| types: | |
| - opened | |
| - edited | |
| - synchronize | |
| jobs: | |
| validate-title: | |
| name: Validate PR title | |
| runs-on: ubuntu-latest | |
| permissions: | |
| pull-requests: read | |
| steps: | |
| - uses: amannn/action-semantic-pull-request@v6 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| apply-label: | |
| name: Apply label from PR title | |
| runs-on: ubuntu-latest | |
| needs: validate-title | |
| permissions: | |
| pull-requests: write | |
| steps: | |
| - uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 | |
| with: | |
| script: | | |
| const title = context.payload.pull_request.title; | |
| const mapping = [ | |
| { pattern: /^(feat|feat!)(\(.+\))?!?:/, label: "enhancement" }, | |
| { pattern: /^perf(\(.+\))?:/, label: "enhancement" }, | |
| { pattern: /^(fix|fix!)(\(.+\))?!?:/, label: "bug" }, | |
| { pattern: /^docs(\(.+\))?:/, label: "documentation" }, | |
| { pattern: /^(chore|build|ci|style|test|refactor)(\(.+\))?:/, label: "maintenance" }, | |
| ]; | |
| // Check for breaking change: trailing ! before colon or BREAKING CHANGE in body | |
| const isBreaking = /^[a-z]+(\(.+\))?!:/.test(title); | |
| if (isBreaking) { | |
| await github.rest.issues.addLabels({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: context.payload.pull_request.number, | |
| labels: ["breaking"], | |
| }); | |
| return; | |
| } | |
| for (const { pattern, label } of mapping) { | |
| if (pattern.test(title)) { | |
| await github.rest.issues.addLabels({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: context.payload.pull_request.number, | |
| labels: [label], | |
| }); | |
| return; | |
| } | |
| } |