Skip to content

Commit 193a9b4

Browse files
authored
feat(github): add default rulesets and installation (#47)
1 parent 3a3ad34 commit 193a9b4

File tree

3 files changed

+69
-0
lines changed

3 files changed

+69
-0
lines changed

.github/rulesets/main.json

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
{
2+
"name": "main",
3+
"target": "branch",
4+
"enforcement": "active",
5+
"conditions": {
6+
"ref_name": {
7+
"exclude": [],
8+
"include": [
9+
"~DEFAULT_BRANCH"
10+
]
11+
}
12+
},
13+
"rules": [
14+
{
15+
"type": "deletion"
16+
},
17+
{
18+
"type": "required_linear_history"
19+
},
20+
{
21+
"type": "pull_request",
22+
"parameters": {
23+
"required_approving_review_count": 0,
24+
"dismiss_stale_reviews_on_push": true,
25+
"require_code_owner_review": false,
26+
"require_last_push_approval": false,
27+
"required_review_thread_resolution": false,
28+
"allowed_merge_methods": [
29+
"squash",
30+
"rebase"
31+
]
32+
}
33+
},
34+
{
35+
"type": "required_status_checks",
36+
"parameters": {
37+
"strict_required_status_checks_policy": true,
38+
"do_not_enforce_on_create": false,
39+
"required_status_checks": [
40+
{
41+
"context": "checks",
42+
"integration_id": 15368
43+
}
44+
]
45+
}
46+
},
47+
{
48+
"type": "non_fast_forward"
49+
}
50+
],
51+
"bypass_actors": [
52+
{
53+
"actor_id": 5,
54+
"actor_type": "RepositoryRole",
55+
"bypass_mode": "always"
56+
}
57+
]
58+
}

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,7 @@ format-source # format code source
287287
install # run install tasks
288288
install-hooks # install git hooks
289289
install-project # install the project
290+
install-rulesets # install github rulesets
290291
291292
[mlflow]
292293
mlflow # run mlflow tasks

tasks/install.just

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,13 @@ install-hooks:
1212
[group('install')]
1313
install-project:
1414
uv sync --all-groups
15+
16+
# install github rulesets
17+
[group('install')]
18+
install-rulesets:
19+
#!/usr/bin/env bash
20+
set -euo pipefail
21+
repo=$(gh repo view --json=name --jq=.name)
22+
owner=$(gh repo view --json=owner --jq=.owner.login)
23+
gh api --method POST -H "Accept: application/vnd.github+json" \
24+
"/repos/$owner/$repo/rulesets" --input=".github/rulesets/main.json"

0 commit comments

Comments
 (0)