diff --git a/.github/workflows/changelog-guard.yml b/.github/workflows/changelog-guard.yml new file mode 100644 index 000000000..754f15026 --- /dev/null +++ b/.github/workflows/changelog-guard.yml @@ -0,0 +1,20 @@ +name: Changelog Guard + +on: + pull_request: + types: [opened, edited, synchronize, reopened, labeled, unlabeled] + paths: + - '**/CHANGELOG.md' + +permissions: {} + +jobs: + changelog-guard: + # Every feature PR appending to the same changelog section conflicts with every other open PR. + if: ${{ !contains(github.event.pull_request.labels.*.name, 'release') }} + runs-on: ${{ vars.DASH_LIGHT_RUNNER || 'ubuntu-latest' }} + steps: + - name: Reject changelog edits outside release PRs + run: | + echo "::error file=CHANGELOG.md::CHANGELOG.md is written when a release is cut. Revert the changelog edit, or add the 'release' label if this is a release PR." + exit 1 diff --git a/.github/workflows/ready-for-review.yml b/.github/workflows/ready-for-review.yml index 65dcf926e..18a5ef380 100644 --- a/.github/workflows/ready-for-review.yml +++ b/.github/workflows/ready-for-review.yml @@ -12,6 +12,7 @@ on: - "Pre-commit Checks" - "Sanitizer" - "Ready for Review Trigger" + - "Changelog Guard" types: [completed] concurrency: diff --git a/AGENTS.md b/AGENTS.md index c7f4a96df..1a2cf7d3d 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -27,7 +27,8 @@ ## Commit & Pull Request Guidelines - Prefer Conventional Commits: `feat:`, `fix:`, `refactor:`, `chore:`, `docs:`. Keep subject ≤72 chars with clear scope and rationale. - Target branches: feature work to `dev` (development), hotfixes/docs to `main` unless directed otherwise. -- Pre‑PR checks: `cargo fmt`, `cargo clippy`, `cargo test` (workspace). Update docs/CHANGELOG if user-facing. +- Pre‑PR checks: `cargo fmt`, `cargo clippy`, `cargo test` (workspace). Update docs if user-facing. +- Do not edit `CHANGELOG.md` in feature PRs. It is written from the merged PR titles when a release is cut, and CI fails a PR that touches it unless a maintainer adds the `release` label. - Include in PRs: description, linked issues, test evidence (commands/output), and notes on features/FFI impacts. ## Security & Configuration Tips diff --git a/CLAUDE.md b/CLAUDE.md index 274cc1301..39d579313 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -182,6 +182,7 @@ cargo doc --open - Default branch: `dev` (active development, target for new PRs) - Stable branch: `main` (tracks latest tagged release) - Release branches: `chore/release-vX.Y.Z` (short-lived, cut from `dev` per release) +- `CHANGELOG.md` is written when a release is cut. Do not edit it in feature PRs. CI fails a PR that touches it unless it carries the `release` label. ## Current Status