From 031781389783edc03a521745001f9ded514de253 Mon Sep 17 00:00:00 2001 From: Vincent Moens Date: Tue, 28 Apr 2026 21:57:42 +0100 Subject: [PATCH] [CI] Add ruleset JSON requiring lint-done on protected branches Adds .github/rulesets/lint-required.json so the configuration that gates merges into main / nightly / release/* on the lint-done aggregator from .github/workflows/lint.yml is reviewable and reproducible. Note: GitHub does not auto-apply files under .github/rulesets/. The JSON is applied via: gh api -X POST repos/pytorch/rl/rulesets \ --input .github/rulesets/lint-required.json See .github/rulesets/README.md for usage. --- .github/rulesets/README.md | 29 +++++++++++++++++++++++++++++ .github/rulesets/lint-required.json | 24 ++++++++++++++++++++++++ 2 files changed, 53 insertions(+) create mode 100644 .github/rulesets/README.md create mode 100644 .github/rulesets/lint-required.json diff --git a/.github/rulesets/README.md b/.github/rulesets/README.md new file mode 100644 index 00000000000..4329b910300 --- /dev/null +++ b/.github/rulesets/README.md @@ -0,0 +1,29 @@ +# Repository rulesets + +Source-of-truth JSON for branch rulesets applied to `pytorch/rl`. + +These files are **not** auto-applied by GitHub. They live here so the configuration +is reviewable, version-controlled, and reproducible. To apply a ruleset: + +```bash +gh api -X POST repos/pytorch/rl/rulesets --input .github/rulesets/.json +``` + +To update an existing ruleset, fetch its id and `PUT`: + +```bash +gh api repos/pytorch/rl/rulesets -q '.[] | select(.name=="") | .id' +gh api -X PUT repos/pytorch/rl/rulesets/ --input .github/rulesets/.json +``` + +To delete: + +```bash +gh api -X DELETE repos/pytorch/rl/rulesets/ +``` + +## Current rulesets + +- `lint-required.json` — gates merges into `main` / `nightly` / `release/*` on + the `lint-done` aggregator from `.github/workflows/lint.yml` and the existing + `Meta CLA Check`. diff --git a/.github/rulesets/lint-required.json b/.github/rulesets/lint-required.json new file mode 100644 index 00000000000..983c0c7967f --- /dev/null +++ b/.github/rulesets/lint-required.json @@ -0,0 +1,24 @@ +{ + "name": "Require lint on protected branches", + "target": "branch", + "enforcement": "active", + "conditions": { + "ref_name": { + "include": ["refs/heads/main", "refs/heads/nightly", "refs/heads/release/*"], + "exclude": [] + } + }, + "rules": [ + { + "type": "required_status_checks", + "parameters": { + "strict_required_status_checks_policy": false, + "do_not_enforce_on_create": false, + "required_status_checks": [ + { "context": "lint-done" }, + { "context": "Meta CLA Check", "integration_id": 1425812 } + ] + } + } + ] +}