Skip to content

ci: dismiss approvals when new commits are pushed to a PR - #573

Closed
MushuEE wants to merge 2 commits into
rulesets/1-as-codefrom
rulesets/2-fresh-approvals
Closed

MushuEE wants to merge 2 commits into
rulesets/1-as-codefrom
rulesets/2-fresh-approvals

Conversation

@MushuEE

@MushuEE MushuEE commented Nov 12, 2026

Copy link
Copy Markdown
Collaborator

Summary

Sets dismiss_stale_reviews_on_push: true on protect-main, so pushing a commit to an approved PR dismisses the approval. CONTRIBUTING.md already says this happens; now the ruleset enforces it.

Stacked on #572. Review only the top commit.

Changes

  • .github/rulesets/protect-main.json: dismiss_stale_reviews_on_push: false → true.
  • CONTRIBUTING.md: after pushing to an approved PR, use Re-request review.
  • docs/rulesets.md, AGENTS.md: updated to match.

Decision: require_last_push_approval

This PR leaves require_last_push_approval at false. Setting it to true would also block a reviewer from approving and then pushing their own commit, but a maintainer who pushes a fix to someone else's PR would then need a third person to approve. Comment here if you'd rather turn it on, and I'll add it to this PR.

After merge (repo admin)

hack/apply-rulesets.sh --dry-run, then hack/apply-rulesets.sh.

Fixes #570.

Set dismiss_stale_reviews_on_push on protect-main, so every change is
approved against its final commits. CONTRIBUTING.md already said a push
after an approval needs a fresh approval, but the ruleset didn't enforce
it.

require_last_push_approval stays false; see #570 for the decision.

Fixes #570.
@mayawang

Copy link
Copy Markdown
Collaborator

I'm in favor if we take the merge queue (#575) with it, since the queue removes most post-approval rebases. @rakyll ok with dismissing stale approvals given our trust-the-author style?

Add two rulesets, both starting in evaluate mode:

- protect-tags: on all tags, block creation, update, deletion and
  force-push for everyone except repo admins, and require names to match
  ^v\d+\.\d+\.\d+(-[0-9A-Za-z.-]+)?$. Targeting all tags, not only v*,
  also keeps ad-hoc tags off the repo.
- protect-release-branches: on release-* branches, the same rules as
  protect-main (no deletion or force-push, PR with 1 approval, stale
  approvals dismissed, build-and-test).

Run go.yml on release-* branches too, so build-and-test reports on
release-branch PRs and the required check can pass.

Document the branch and tag naming rules in docs/rulesets.md.

Part of #547.
@rakyll

rakyll commented Nov 14, 2026

Copy link
Copy Markdown
Member

Don't merge this. We don't want to dismiss approvals. Every contributor is a trusted contributor in AX.

@mayawang

Copy link
Copy Markdown
Collaborator

Sounds good, let's not dismiss approvals. @MushuEE could you pull the tag/release-branch protection (#574, it landed in this branch rather than main) into its own PR, and update the CONTRIBUTING line that says a push needs fresh approval? Then we can close this one. Still need the admin bypass in protect-main.json before I apply.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants