Skip to content

Commit 480c75d

Browse files
fix: bypass repository admin (id 5) in branch ruleset (#1791)
## PR Checklist - [x] Addresses an existing open issue: fixes #1790 - [x] That issue was marked as [`status: accepting prs`](https://github.com/JoshuaKGoldberg/create-typescript-app/issues?q=is%3Aopen+is%3Aissue+label%3A%22status%3A+accepting+prs%22) - [x] Steps in [CONTRIBUTING.md](https://github.com/JoshuaKGoldberg/create-typescript-app/blob/main/.github/CONTRIBUTING.md) were taken ## Overview Pending being told contrary information, hardcodes `actor_id: 5` for the repository role to always be allowed to bypass branch protection ruleset. 💖
1 parent 4e3642d commit 480c75d

File tree

3 files changed

+32
-0
lines changed

3 files changed

+32
-0
lines changed

src/next/blocks/blockRepositoryBranchRuleset.ts

+9
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,15 @@ export const blockRepositoryBranchRuleset = base.createBlock({
1616
id: "branch-ruleset",
1717
async send({ octokit }) {
1818
await octokit.request("POST /repos/{owner}/{repo}/rulesets", {
19+
bypass_actors: [
20+
{
21+
// This *seems* to be the Repository Admin role always?
22+
// https://github.com/github/rest-api-description/issues/4406
23+
actor_id: 5,
24+
actor_type: "RepositoryRole",
25+
bypass_mode: "always",
26+
},
27+
],
1928
conditions: {
2029
ref_name: {
2130
exclude: [],

src/steps/initializeBranchProtectionSettings.test.ts

+14
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,13 @@ describe("migrateBranchProtectionSettings", () => {
3939
[
4040
"POST /repos/{owner}/{repo}/rulesets",
4141
{
42+
"bypass_actors": [
43+
{
44+
"actor_id": 5,
45+
"actor_type": "RepositoryRole",
46+
"bypass_mode": "always",
47+
},
48+
],
4249
"conditions": {
4350
"ref_name": {
4451
"exclude": [],
@@ -152,6 +159,13 @@ describe("migrateBranchProtectionSettings", () => {
152159
[
153160
"POST /repos/{owner}/{repo}/rulesets",
154161
{
162+
"bypass_actors": [
163+
{
164+
"actor_id": 5,
165+
"actor_type": "RepositoryRole",
166+
"bypass_mode": "always",
167+
},
168+
],
155169
"conditions": {
156170
"ref_name": {
157171
"exclude": [],

src/steps/initializeGitHubRepository/initializeBranchProtectionSettings.ts

+9
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,15 @@ export async function initializeBranchProtectionSettings(
99
) {
1010
try {
1111
await octokit.request("POST /repos/{owner}/{repo}/rulesets", {
12+
bypass_actors: [
13+
{
14+
// This *seems* to be the Repository Admin role always?
15+
// https://github.com/github/rest-api-description/issues/4406
16+
actor_id: 5,
17+
actor_type: "RepositoryRole",
18+
bypass_mode: "always",
19+
},
20+
],
1221
conditions: {
1322
ref_name: {
1423
exclude: [],

0 commit comments

Comments
 (0)