2026-07-25 19:01:08 +00:00
|
|
|
# action/check-naming
|
|
|
|
|
|
2026-08-26 13:26:41 +00:00
|
|
|
Composite Gitea Action that validates a pull request's branch, title, Bug
|
|
|
|
|
tracking, and AI authorship against the fritzlab Git standard. The current
|
|
|
|
|
action fails (exits 1) on any violation; `@v1` is the legacy warn-only release
|
2026-07-26 18:05:26 +00:00
|
|
|
(Bugs program: see
|
2026-07-25 19:01:08 +00:00
|
|
|
[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
|
2026-08-27 18:30:36 +00:00
|
|
|
on:
|
|
|
|
|
pull_request:
|
|
|
|
|
types: [opened, synchronize, reopened, edited]
|
|
|
|
|
|
2026-07-25 19:01:08 +00:00
|
|
|
jobs:
|
|
|
|
|
naming:
|
|
|
|
|
runs-on: fritzlab
|
|
|
|
|
timeout-minutes: 5
|
|
|
|
|
steps:
|
2026-08-26 13:26:41 +00:00
|
|
|
- uses: actions/checkout@v4
|
|
|
|
|
with:
|
|
|
|
|
fetch-depth: 0
|
|
|
|
|
- uses: https://code.fritzlab.net/action/check-naming@<commit-sha>
|
2026-07-25 19:01:08 +00:00
|
|
|
with:
|
|
|
|
|
head-branch: ${{ github.head_ref }}
|
|
|
|
|
pr-title: ${{ github.event.pull_request.title }}
|
|
|
|
|
pr-author: ${{ github.event.pull_request.user.login }}
|
2026-08-27 17:26:13 +00:00
|
|
|
server-url: ${{ github.server_url }}
|
|
|
|
|
token: ${{ github.token }}
|
2026-08-26 13:26:41 +00:00
|
|
|
base-sha: ${{ github.event.pull_request.base.sha }}
|
|
|
|
|
head-sha: ${{ github.event.pull_request.head.sha }}
|
2026-07-25 19:01:08 +00:00
|
|
|
```
|
|
|
|
|
|
2026-08-27 18:30:36 +00:00
|
|
|
The explicit `edited` activity is part of the enforcement contract: changing
|
|
|
|
|
the PR description must issue a new naming status for the same commit.
|
|
|
|
|
Description-only events may skip unrelated validation jobs.
|
|
|
|
|
|
2026-07-26 18:05:26 +00:00
|
|
|
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.
|
|
|
|
|
|
2026-07-25 19:01:08 +00:00
|
|
|
## 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 |
|
2026-08-27 17:26:13 +00:00
|
|
|
| `server-url` | yes | Gitea server URL — `github.server_url` |
|
|
|
|
|
| `token` | yes | Gitea Actions token — `github.token` |
|
2026-08-26 13:26:41 +00:00
|
|
|
| `base-sha` | yes | Base commit — `github.event.pull_request.base.sha` |
|
|
|
|
|
| `head-sha` | yes | Head commit — `github.event.pull_request.head.sha` |
|
2026-07-25 19:01:08 +00:00
|
|
|
|
|
|
|
|
## Behavior
|
|
|
|
|
|
2026-08-27 16:55:08 +00:00
|
|
|
The check validates four things for every non-break-glass Agent PR:
|
2026-07-25 19:01:08 +00:00
|
|
|
|
|
|
|
|
1. **Branch form** — must be `<role>/bug-<id>/<kebab>` or `chore/<kebab>`.
|
|
|
|
|
Unknown roles, missing `bug-` segment, uppercase bug-ids, and empty
|
2026-07-26 18:05:26 +00:00
|
|
|
kebab descriptions all produce a `FAIL[check-naming]` log line.
|
2026-07-25 19:01:08 +00:00
|
|
|
|
2026-07-26 18:05:26 +00:00
|
|
|
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]`
|
2026-08-27 17:36:56 +00:00
|
|
|
prefix. If both carry a bug-id they must match.
|
2026-07-25 19:01:08 +00:00
|
|
|
|
2026-08-27 16:55:08 +00:00
|
|
|
3. **Tracking and attribution** — on Bug-backed work, `## Tracking` contains both the literal
|
2026-08-26 13:26:41 +00:00
|
|
|
`Fixes bug-<id>` automation token and the matching navigable
|
2026-08-27 16:55:08 +00:00
|
|
|
`https://agenthub.fritzlab.net/bug-<id>` URL. Every PR has a separate
|
|
|
|
|
`## Attribution` section containing the canonical `Authored-By`
|
2026-08-27 18:17:27 +00:00
|
|
|
product/model watermark. The action loads the body from Gitea by repository
|
|
|
|
|
and PR number, then asks Gitea to render it; both calls have a bounded
|
|
|
|
|
5-second connection and 15-second total wait. It then checks visible
|
2026-08-27 17:35:21 +00:00
|
|
|
`<h2>` sections outside collapsed `<details>` content. Fenced, commented,
|
|
|
|
|
scripted, or collapsed copies do not satisfy the visible provenance contract.
|
2026-08-26 13:26:41 +00:00
|
|
|
|
2026-08-27 16:55:08 +00:00
|
|
|
4. **Commit attribution** — every commit in `base-sha..head-sha`, including
|
|
|
|
|
commits on `chore/` branches, ends with
|
2026-08-26 13:26:41 +00:00
|
|
|
the canonical `Authored-By` trailer, separated from the message body by a
|
|
|
|
|
blank line. The naming job must check out full history before this action.
|
|
|
|
|
|
2026-07-26 18:05:26 +00:00
|
|
|
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
|
|
|
|
|
|
2026-08-26 13:26:41 +00:00
|
|
|
- unreleased — adds Bug tracking plus PR and commit attribution enforcement.
|
|
|
|
|
- `v2` — enforces branch and title naming.
|
2026-07-26 18:05:26 +00:00
|
|
|
- `v1` — legacy warn-only: logs `WARN` lines, always exits 0.
|
2026-07-25 19:01:08 +00:00
|
|
|
|
|
|
|
|
## Tests
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
bash tests/run
|
|
|
|
|
```
|