diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 595d3d5..3624123 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -10,7 +10,7 @@ Closes # ## Checklist -- [ ] Linked to an issue (exempt: Renovate, Dependabot, release-please) +- [ ] Closes at least one issue (`Closes #N`), and every issue this change finishes is named (exempt: Renovate, Dependabot, release-please) - [ ] Label, milestone, assignee and project match the issue - [ ] Docs updated (README, `AGENTS.md`, `docs/`) if behavior changed - [ ] Network policy and monitoring included for any new workload diff --git a/.github/workflows/pr-governance.yml b/.github/workflows/pr-governance.yml index eae047f..1c374a3 100644 --- a/.github/workflows/pr-governance.yml +++ b/.github/workflows/pr-governance.yml @@ -43,9 +43,9 @@ jobs: fail=0 err() { echo "::error::$1"; fail=1; } - # 1. Issue link: Closes/Fixes/Resolves/Refs/Part of #N or owner/repo#N - if ! jq -r .body <<<"$pr" | grep -Eiq '(clos(e|es|ed)|fix(es|ed)?|resolv(e|es|ed)|refs?|part of)[: ]+([A-Za-z0-9_.-]+/[A-Za-z0-9_.-]+)?#[0-9]+'; then - err "The description must reference an issue (for example 'Closes #123')." + # 1. A pull request always closes an issue: Closes/Fixes/Resolves #N or owner/repo#N. `Part of` and `Refs` do not count. + if ! jq -r .body <<<"$pr" | grep -Eiq '(clos(e|es|ed)|fix(es|ed)?|resolv(e|es|ed))[: ]+([A-Za-z0-9_.-]+/[A-Za-z0-9_.-]+)?#[0-9]+'; then + err "The description must close an issue (for example 'Closes #123'). A pull request always closes one; an issue is closed only by a pull request." fi # 2. Label, milestone, assignee [ "$(jq '.labels|length' <<<"$pr")" -gt 0 ] || err "Add at least one label (area/*)." diff --git a/AGENTS.md b/AGENTS.md index 5ca2002..c59320b 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -43,7 +43,7 @@ Read [GOVERNANCE.md](GOVERNANCE.md) for the full rules. In short: 2. An issue has exactly one **type** (Epic, Feature, Task, Bug, Chore, Security, Docs), one `area/*` label, a **priority** (P0 to P3) and an **estimate in hours** (project fields), an assignee, a milestone and a project. 3. Work happens on a **branch** (`feat/...`, `fix/...`, `docs/...`, `chore/...`) and reaches `main` through a **pull request** - that references its issue (`Closes #N`). Nobody pushes to `main`. Renovate, Dependabot and release-please pull requests are exempt + that closes its issue (`Closes #N`): a pull request always closes an issue, and an issue is closed only by a pull request. Nobody pushes to `main`. Renovate, Dependabot and release-please pull requests are exempt from the issue requirement. 4. **Time** is logged in a comment, `/time 1h30 what was done`, on the issue or the pull request. 5. Issues, pull requests, commits and code comments are written in **English**. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index fddfcc8..395f4d1 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -15,7 +15,7 @@ By taking part you agree to follow the [Code of Conduct](CODE_OF_CONDUCT.md). Issues that are good first steps carry the `good first issue` label. 2. **Fork or branch** from an up-to-date `main`: `feat/...`, `fix/...`, `docs/...`, `chore/...`. Maintainers never commit to `main` directly either. 3. **Make a focused change** that matches the surrounding code and docs. Run the repository's checks (see its README or `AGENTS.md`). -4. **Open a pull request** in English that says `Closes #N`, explains what changed and how you tested it. Fill in the template. +4. **Open a pull request** in English that says `Closes #N` (a pull request always closes an issue, and an issue is closed only by a pull request), explains what changed and how you tested it. Fill in the template. 5. **Respond to review.** A maintainer merges once checks are green and the change is understood. ## Standards diff --git a/GOVERNANCE.md b/GOVERNANCE.md index 4a4a222..1d6c788 100644 --- a/GOVERNANCE.md +++ b/GOVERNANCE.md @@ -45,12 +45,12 @@ project's built-in workflows when a pull request is opened or merged and an issu ## Pull requests - Branch off an up-to-date `main`, named `feat/`, `fix/`, `docs/`, `chore/` + short subject. Never commit to `main`. -- The pull request description is in English, references its issue (`Closes #N`; `Refs #N` for a partial step) and says what was - tested. The issue and the pull request carry the same label, milestone and project. +- The pull request description is in English, closes its issue (`Closes #N`) and says what was + tested. A pull request always closes at least one issue, and an issue is closed only by a pull request: never by hand, never by a comment. One subject is one issue. An epic is closed by the pull request that finishes its last sub-issue, which names the epic too. If a change is partial, the leftover is a new issue before the pull request, not a `Refs`. The issue and the pull request carry the same label, milestone and project. - It has an assignee and a requested reviewer. Review ownership comes from `CODEOWNERS`. Since a single maintainer cannot approve their own pull request, "reviewed" means a reviewer was requested and checks are green; whoever merges states what was verified. -- Required checks must pass. The `pr-governance` check verifies the issue link, label, milestone and assignee. +- Required checks must pass. The `pr-governance` check verifies the closing keyword, label, milestone and assignee. - Exempt from the issue link: Renovate, Dependabot and release-please pull requests. - Squash or merge as the repository prefers; keep commit messages in English, imperative, with a conventional prefix (`feat(scope):`, `fix(scope):`, `docs:`, `chore:`).