feat: All Servers mode with aggregated monitors (all-profiles phase 2) #75
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 Guard | |
| # Gate for the AGENTS.project.md rule: every PR carries a `core` (changes | |
| # behavior) or `refactor` (behavior-preserving) label. When neither is | |
| # present, one is derived from the PR's conventional-commit types and | |
| # applied automatically; a hand-applied label always wins. Other labels are | |
| # ignored. Lives outside ci.yml so label events re-run only this | |
| # seconds-long job, not the build matrix. | |
| on: | |
| pull_request: | |
| types: [opened, synchronize, reopened, labeled, unlabeled] | |
| permissions: | |
| pull-requests: write | |
| concurrency: | |
| group: label-guard-${{ github.event.pull_request.number }} | |
| cancel-in-progress: true | |
| jobs: | |
| label-guard: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Auto-assign or validate core/refactor label | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| PR: ${{ github.event.pull_request.number }} | |
| REPO: ${{ github.repository }} | |
| LABELS: ${{ join(github.event.pull_request.labels.*.name, ' ') }} | |
| IS_FORK: ${{ github.event.pull_request.head.repo.full_name != github.repository }} | |
| run: | | |
| case " $LABELS " in | |
| *" core "*|*" refactor "*) echo "label present: $LABELS"; exit 0 ;; | |
| esac | |
| if [ "$IS_FORK" = "true" ]; then | |
| # Fork tokens are read-only; a maintainer labels these by hand. | |
| echo "fork PR: skipping auto-assign"; exit 0 | |
| fi | |
| TYPES=$(gh pr view "$PR" --repo "$REPO" --json commits \ | |
| --jq '.commits[].messageHeadline' \ | |
| | sed -E 's/^Revert .*/revert/; s/^Merge .*/chore/; s/^([a-z]+)(\([^)]*\))?!?:.*/\1/') | |
| echo "commit types:"; echo "$TYPES" | |
| if echo "$TYPES" | grep -vqE '^(feat|fix|perf|refactor|docs|test|chore|style|build|ci|revert)$'; then | |
| echo "::error::non-conventional commit subject (P5); cannot classify, apply core or refactor by hand" | |
| exit 1 | |
| fi | |
| if echo "$TYPES" | grep -qE '^(feat|fix|perf|revert)$'; then LABEL=core; else LABEL=refactor; fi | |
| gh pr edit "$PR" --repo "$REPO" --add-label "$LABEL" | |
| echo "auto-assigned: $LABEL" |