fix: report first TCP connection attempt as status, not error #4752
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: Pull Request Labels | |
| on: | |
| pull_request_target: | |
| types: [opened, edited, reopened, synchronize, labeled, unlabeled] | |
| permissions: | |
| pull-requests: write | |
| jobs: | |
| label: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Apply label from title | |
| uses: actions/github-script@v7 | |
| with: | |
| script: | | |
| // Map conventional-commit types to the repo's PR labels. | |
| const typeToLabel = { | |
| feat: 'feature', | |
| fix: 'fix', | |
| docs: 'doc', | |
| chore: 'chore', | |
| test: 'test', | |
| refactor: 'refactor', | |
| perf: 'other', | |
| style: 'other', | |
| build: 'chore', | |
| ci: 'chore' | |
| } | |
| const title = context.payload.pull_request.title || '' | |
| // <type>(<optional scope>)<optional !>: e.g. "feat:", "fix(docker):" | |
| const match = title.match(/^\s*([a-z]+)(\([^)]*\))?!?:/i) | |
| if (!match) { | |
| core.info(`No conventional prefix found in title: "${title}"`) | |
| return | |
| } | |
| const type = match[1].toLowerCase() | |
| const label = typeToLabel[type] | |
| if (!label) { | |
| core.info(`Unrecognized type "${type}", no label applied`) | |
| return | |
| } | |
| const { owner, repo } = context.repo | |
| const issue_number = context.payload.pull_request.number | |
| const managed = new Set(Object.values(typeToLabel)) | |
| const current = context.payload.pull_request.labels.map((l) => l.name) | |
| // Remove any other managed label so exactly one type label remains. | |
| for (const name of current) { | |
| if (managed.has(name) && name !== label) { | |
| await github.rest.issues.removeLabel({ | |
| owner, | |
| repo, | |
| issue_number, | |
| name | |
| }) | |
| } | |
| } | |
| if (!current.includes(label)) { | |
| await github.rest.issues.addLabels({ | |
| owner, | |
| repo, | |
| issue_number, | |
| labels: [label] | |
| }) | |
| core.info(`Applied label "${label}" for type "${type}"`) | |
| } else { | |
| core.info(`Label "${label}" already present`) | |
| } | |
| - name: Require exactly one type label | |
| uses: mheap/github-action-required-labels@v5 | |
| with: | |
| mode: exactly | |
| count: 1 | |
| labels: 'fix, feature, doc, chore, test, ignore, other, dependencies, refactor' |