diff --git a/.github/workflows/decision-records.yml b/.github/workflows/decision-records.yml index 939ccb1..0e47fd3 100644 --- a/.github/workflows/decision-records.yml +++ b/.github/workflows/decision-records.yml @@ -46,8 +46,13 @@ jobs: env: EVENT_NAME: ${{ github.event_name }} HEAD_REF: ${{ github.head_ref }} + # The beta -> main release PR carries every record that landed on beta, and each one already passed the + # branch rule on its own PR. A fork's branch named beta is not this PR, so the repo is checked too. + RELEASE_PR: >- + ${{ github.event_name == 'pull_request' && github.head_ref == 'beta' && github.base_ref == 'main' + && github.event.pull_request.head.repo.full_name == github.repository }} run: | - if [ "$EVENT_NAME" = "pull_request" ]; then + if [ "$EVENT_NAME" = "pull_request" ] && [ "$RELEASE_PR" != "true" ]; then npx tsx scripts/ci/decisionRecords.ts check --branch "$HEAD_REF" --base HEAD^1 else npx tsx scripts/ci/decisionRecords.ts check diff --git a/AGENTS.md b/AGENTS.md index c97ce9f..0ce92cc 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -94,7 +94,7 @@ gitlab-component-helper/ ## Git Workflow **Branch naming:** `/-`, with the issue number right after the type, for example `fix/412-hover-crash`. The type is one of the commitlint types: `feat`, `fix`, `docs`, `style`, `refactor`, `perf`, `test`, `build`, `ci`, `chore` or `revert`. Branches that tools name for themselves (`dependabot/`, `copilot/`, `claude/`) only get a warning from the Decision Records check, but when you pick the name, use a type prefix. See [Issues, branches, and records](#issues-branches-and-records). -**Target branch:** PRs go to `beta`. `main` only takes the `beta` -> `main` release PR, whose head is `beta` itself, so it has no issue number and only gets the warning. +**Target branch:** PRs go to `beta`. `main` only takes the `beta` -> `main` release PR, whose head is `beta` itself. The check skips the branch rule for that PR, since each record on `beta` already passed it on its own PR, and still validates the stores. **Commit format:** `type(scope): description` **Release:** release-it bumps the version + CHANGELOG on push to `beta`/`main` (ci.yml `release` job); publishing to the Marketplace is a manual `workflow_dispatch` (Publish / Publish Beta). See [`docs/RELEASING.md`](docs/RELEASING.md) @@ -176,7 +176,7 @@ Rules: | `'' is required`, `must be one of ...`, `must be a list of text items`, `'date' must be a quoted 'YYYY-MM-DD'` | Fix that field in the record file. | | `'supersedes' names '', which is in neither ...` | Fix the key, or drop it from `supersedes`. | | `could not diff against base ''` | Fetch the base first (`git fetch origin beta`) and pass a ref that exists. | -| Warning: `branch '...' has no issue number` | Only a warning. Fine for Dependabot, fork PRs and the `beta` -> `main` release PR. For anything else, move to a branch with an issue number. | +| Warning: `branch '...' has no issue number` | Only a warning. Fine for Dependabot and fork PRs. For anything else, move to a branch with an issue number. | Fork PRs run the same check with a read-only token and no secrets. A fork's branch name is the contributor's choice, so a fork branch without an issue number gets the warning, and only fails if it adds a record. diff --git a/scripts/ci/decisionRecordsBranch.ts b/scripts/ci/decisionRecordsBranch.ts index 1d7c2f5..5c53119 100644 --- a/scripts/ci/decisionRecordsBranch.ts +++ b/scripts/ci/decisionRecordsBranch.ts @@ -45,7 +45,7 @@ export function branchFindings(added: readonly string[], branch: string): Findin return { errors: [], warnings: [`branch '${branch}' has no issue number; name branches ${BRANCH_FORMAT} (${DOCS_POINTER}). ` - + 'Fine for Dependabot, forks and the beta -> main release PR'], + + 'Fine for Dependabot and forks'], }; } if (issue === undefined) {