chore(deps-dev): update development dependencies #48
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 Checker | |
| # Every PR must carry a categorizing label. This workflow derives the label from | |
| # the conventional-commit PR title and applies it, then confirms it is present. | |
| # | |
| # Labeling and the check live in ONE workflow on purpose. The label is applied | |
| # with the default GITHUB_TOKEN, and GitHub does not fire new workflow events | |
| # (e.g. `labeled`) from GITHUB_TOKEN actions, so a separate checker keyed on the | |
| # `labeled` event would never re-run after the label was added and would stay | |
| # failed on a fresh PR. Running the check as a job that `needs` the autolabel job | |
| # guarantees the label is applied in the same run. | |
| # | |
| # The label is applied deterministically with `gh` rather than relying on | |
| # release-drafter's autolabeler, which does not reliably apply labels in this | |
| # configuration. The release-drafter.yml autolabeler block is still used at draft | |
| # time; this job is what guarantees a categorizing label on every PR. | |
| on: | |
| pull_request: | |
| types: [opened, reopened, edited, synchronize] | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event.pull_request.number }} | |
| cancel-in-progress: true | |
| permissions: | |
| contents: read | |
| pull-requests: write | |
| jobs: | |
| autolabel: | |
| name: Autolabel | |
| runs-on: ubuntu-latest | |
| steps: | |
| # Map the conventional-commit prefix in the PR title to a categorizing | |
| # label and apply it. Best-effort (continue-on-error): the | |
| # categorizing-label job below is the authoritative check. | |
| - name: Apply label from PR title | |
| continue-on-error: true | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| PR: ${{ github.event.pull_request.number }} | |
| REPO: ${{ github.repository }} | |
| TITLE: ${{ github.event.pull_request.title }} | |
| run: | | |
| # Derive the label from the conventional-commit type/prefix. | |
| label="" | |
| case "$TITLE" in | |
| *"!:"*|*"BREAKING CHANGE"*|*"BREAKING-CHANGE"*) label="breaking" ;; | |
| feat\(*\)!:*|feat!:*) label="breaking" ;; | |
| feat:*|feat\(*\):*) label="enhancement" ;; | |
| fix:*|fix\(*\):*) label="fix" ;; | |
| perf:*|perf\(*\):*) label="performance" ;; | |
| refactor:*|refactor\(*\):*) label="refactor" ;; | |
| docs:*|docs\(*\):*) label="documentation" ;; | |
| security:*|security\(*\):*) label="security" ;; | |
| build:*|build\(*\):*|chore\(deps*\):*) label="dependencies" ;; | |
| ci:*|ci\(*\):*|test:*|test\(*\):*|style:*|style\(*\):*|chore:*|chore\(*\):*) label="skip-changelog" ;; | |
| *) echo "PR title is not a recognized conventional-commit type; leaving labels alone."; exit 0 ;; | |
| esac | |
| echo "Applying label: $label" | |
| gh api -X POST "repos/$REPO/issues/$PR/labels" -f "labels[]=$label" >/dev/null | |
| categorizing-label: | |
| name: Categorizing label present | |
| needs: [autolabel] | |
| # Run even if autolabel was skipped/failed; the label may already be present | |
| # from the PR title. | |
| if: always() | |
| runs-on: ubuntu-latest | |
| permissions: | |
| pull-requests: read | |
| steps: | |
| # Poll the LIVE labels via the API rather than the trigger payload. The | |
| # autolabel job above applies the label with the default GITHUB_TOKEN; that | |
| # write takes a moment to be visible, and the `opened` event payload this | |
| # run was triggered with never carries it. Retrying against the API closes | |
| # that race so a fresh PR passes on the first run instead of needing a rerun. | |
| - name: Verify a categorizing label is present | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| PR: ${{ github.event.pull_request.number }} | |
| REPO: ${{ github.repository }} | |
| run: | | |
| allowed="breaking enhancement bug fix performance refactor changed deprecated removed security documentation dependencies skip-changelog" | |
| for attempt in 1 2 3 4 5 6; do | |
| labels="$(gh api "repos/$REPO/issues/$PR/labels" --jq '.[].name' 2>/dev/null || true)" | |
| for l in $labels; do | |
| for a in $allowed; do | |
| if [ "$l" = "$a" ]; then echo "Found categorizing label: $l"; exit 0; fi | |
| done | |
| done | |
| echo "No categorizing label yet (attempt $attempt/6); waiting for the autolabeler..." | |
| sleep 10 | |
| done | |
| echo "No categorizing label present. Add one of: $allowed" | |
| exit 1 |