Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/rulesets/protect-main.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"squash",
"rebase"
],
"dismiss_stale_reviews_on_push": false,
"dismiss_stale_reviews_on_push": true,
"dismissal_restriction": {
"allowed_actors": [],
"enabled": false
Expand Down
55 changes: 55 additions & 0 deletions .github/rulesets/protect-release-branches.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
{
"bypass_actors": [],
"conditions": {
"ref_name": {
"exclude": [],
"include": [
"refs/heads/release-*"
]
}
},
"enforcement": "evaluate",
"name": "protect-release-branches",
"rules": [
{
"type": "deletion"
},
{
"type": "non_fast_forward"
},
{
"parameters": {
"allowed_merge_methods": [
"squash",
"rebase"
],
"dismiss_stale_reviews_on_push": true,
"dismissal_restriction": {
"allowed_actors": [],
"enabled": false
},
"require_code_owner_review": false,
"require_extra_approval_for_unattributed_changes": true,
"require_last_push_approval": false,
"required_approving_review_count": 1,
"required_review_thread_resolution": false,
"required_reviewers": []
},
"type": "pull_request"
},
{
"parameters": {
"do_not_enforce_on_create": false,
"required_status_checks": [
{
"context": "build-and-test",
"integration_id": 15368
}
],
"strict_required_status_checks_policy": false
},
"type": "required_status_checks"
}
],
"target": "branch"
}
43 changes: 43 additions & 0 deletions .github/rulesets/protect-tags.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{
"bypass_actors": [
{
"actor_id": 5,
"actor_type": "RepositoryRole",
"bypass_mode": "always"
}
],
"conditions": {
"ref_name": {
"exclude": [],
"include": [
"~ALL"
]
}
},
"enforcement": "evaluate",
"name": "protect-tags",
"rules": [
{
"type": "creation"
},
{
"type": "deletion"
},
{
"type": "non_fast_forward"
},
{
"parameters": {
"name": "",
"negate": false,
"operator": "regex",
"pattern": "^v\\d+\\.\\d+\\.\\d+(-[0-9A-Za-z.-]+)?$"
},
"type": "tag_name_pattern"
},
{
"type": "update"
}
],
"target": "tag"
}
4 changes: 2 additions & 2 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ name: Go

on:
push:
branches: [ "main" ]
branches: [ "main", "release-*" ]
pull_request:
branches: [ "main" ]
branches: [ "main", "release-*" ]

permissions:
contents: read
Expand Down
8 changes: 6 additions & 2 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,14 @@ location is where to look. How-to lives in the skills.
Apache-2.0 header (copy from `Makefile`).

**E. Process** (`CONTRIBUTING.md`, `.github/rulesets/`)
- One approving review + green `build-and-test` to merge; a push after
approval needs a fresh approval. Assign yourself to the issue or PR you pick up.
- One approving review + green `build-and-test` to merge; pushing to an
approved PR dismisses the approval (`dismiss_stale_reviews_on_push`).
Assign yourself to the issue or PR you pick up.
- Rulesets are edited only through `.github/rulesets/*.json`, never in the
GitHub UI alone; `.github/workflows/rulesets.yml` fails daily on drift.
- Only `main` and `release-X.Y` are long-lived branches; only repo admins
create `vX.Y.Z[-pre]` tags (`protect-tags.json`). `go.yml` runs on both
`main` and `release-*`.

## Skills — load before coding

Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ This project follows [Google's Open Source Community Guidelines](https://opensou

All submissions, including submissions by project members, require review. We use GitHub pull requests for this purpose. Consult [GitHub Help](https://help.github.com/articles/about-pull-requests/) for more information on using pull requests.

Every pull request to `main` needs one approving review and a passing `build-and-test` check before it can be merged. A push after an approval needs a fresh approval. These rules are enforced by the repository rulesets in [`.github/rulesets/`](.github/rulesets); see [docs/rulesets.md](docs/rulesets.md) for how to change them.
Every pull request to `main` needs one approving review and a passing `build-and-test` check before it can be merged. Pushing a commit to an approved pull request dismisses the approval; after pushing, use **Re-request review** so the reviewer approves the final commits. These rules are enforced by the repository rulesets in [`.github/rulesets/`](.github/rulesets); see [docs/rulesets.md](docs/rulesets.md) for how to change them.

When you start on an issue or pull request, assign yourself to it, so others know it is being worked on.

Expand Down
11 changes: 10 additions & 1 deletion docs/rulesets.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,20 @@ reviewed and recorded like any other change.

| Ruleset | Applies to | Rules |
|---|---|---|
| [`protect-main`](../.github/rulesets/protect-main.json) | `main` (`~DEFAULT_BRANCH`) | No deletion or force-push. Changes go through a pull request with 1 approving review, merged by squash or rebase. The `build-and-test` check must pass. |
| [`protect-main`](../.github/rulesets/protect-main.json) | `main` (`~DEFAULT_BRANCH`) | No deletion or force-push. Changes go through a pull request with 1 approving review, merged by squash or rebase. Pushing a new commit dismisses existing approvals. The `build-and-test` check must pass. |
| [`protect-release-branches`](../.github/rulesets/protect-release-branches.json) | `release-*` branches | The same rules as `protect-main`. Starts in `evaluate` mode. |
| [`protect-tags`](../.github/rulesets/protect-tags.json) | All tags | Only repo admins can create, move or delete tags. Tag names must be semantic versions, `vX.Y.Z` or `vX.Y.Z-<pre-release>`. Starts in `evaluate` mode. |

The JSON files are the source of truth. If this table and a file disagree, the
file wins.

## Branches and tags

- `main` and `release-X.Y` are the only long-lived branches on `google/ax`.
Delete other branches once their pull request is merged or closed.
- Release tags are `vX.Y.Z` or `vX.Y.Z-<pre-release>` (for example
`v0.4.0-rc.1`). Other tags aren't allowed on `google/ax`.

## Changing a ruleset

1. Edit or add a file in `.github/rulesets/`. Each file holds one ruleset, in
Expand Down