Files
check-naming/README.md
T
architectandClaude Fable 5 9bfbd24461
test / test (pull_request) Successful in 4s
v2: fail (exit 1) on naming violation
The four wired repos flip the naming job to a required status check
(agenthub#557 WS6); a check that always exits 0 can never gate. v2 makes
the script exit nonzero with FAIL lines; warn-only stays available via
job-level continue-on-error or the legacy @v1 tag. dfritz break-glass
exemption unchanged.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-26 18:05:26 +00:00

76 lines
2.7 KiB
Markdown

# action/check-naming
Composite Gitea Action that validates a pull request's head branch name
and title against the fritzlab naming standard. `@v2` fails (exits 1) on
any violation; `@v1` is the legacy warn-only release that never fails
(Bugs program: see
[fritzlab/agenthub#557](https://code.fritzlab.net/fritzlab/agenthub/issues/557)).
## Standard
```
Branch: <role>/bug-<id>/<kebab-description> e.g. dev/bug-x7k2m9/fix-terminal-resize
Chore: chore/<kebab-description> bug-less trivia only (dep bumps, typos, CI tweaks)
Title: [bug-x7k2m9] Fix terminal resize loss (chore PRs: no [bug-id] prefix)
```
- `<role>` must be a roster handle: `dev` | `ux` | `ops` | `security` | `perf` | `architect` | `support`
- `<bug-id>` is `bug-` followed by lowercase alphanumeric characters
- `<kebab-description>` is lowercase alphanumeric with hyphens, starting with a letter or digit
- When both the branch and the title carry a bug-id they **must match**
- Break-glass: PRs authored by `dfritz` are exempt from all checks
## Usage
```yaml
jobs:
naming:
runs-on: fritzlab
timeout-minutes: 5
steps:
- uses: https://code.fritzlab.net/action/check-naming@v2
with:
head-branch: ${{ github.head_ref }}
pr-title: ${{ github.event.pull_request.title }}
pr-author: ${{ github.event.pull_request.user.login }}
```
To wire a new repo warn-only first, add `continue-on-error: true` to the
job — the step still fails, but the job cannot block the PR.
## Inputs
| Name | Required | Description |
|---|---|---|
| `head-branch` | yes | Head branch name — `github.head_ref` |
| `pr-title` | yes | PR title — `github.event.pull_request.title` |
| `pr-author` | no | PR author login — `github.event.pull_request.user.login`; `dfritz` is exempt |
## Behavior
The check validates two things:
1. **Branch form** — must be `<role>/bug-<id>/<kebab>` or `chore/<kebab>`.
Unknown roles, missing `bug-` segment, uppercase bug-ids, and empty
kebab descriptions all produce a `FAIL[check-naming]` log line.
2. **Title form** — for a `role/bug` branch the title must start with
`[bug-<id>] `. For a `chore` branch the title must have no `[bug-id]`
prefix. If both carry a bug-id they must match.
Every violation prints a `FAIL[check-naming]: ...` line and the step
exits 1. To make the check required on a repo: drop any
`continue-on-error: true` from the consuming workflow and add the job's
context to the repo's `status_check_contexts` in agenthub `hub/hub.yaml`.
## Versions
- `v2` — enforcing: exits 1 on violation (current).
- `v1` — legacy warn-only: logs `WARN` lines, always exits 0.
## Tests
```
bash tests/run
```