Skip to content

Commit 8d1787a

Browse files
feat: remove legacy main branch protections in ruleset transition mode (#2028)
## PR Checklist - [x] Addresses an existing open issue: fixes #2016 - [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 Includes updates to the latest Bingo packages to bring in silent requests: JoshuaKGoldberg/bingo#313 I would have liked to go with a rename or archive kind of API, even changing the protection to be on some branch like `main-prior-to-cta`. But such a GitHub API does not exist. 🤷 🎁
1 parent fb56085 commit 8d1787a

7 files changed

+101
-48
lines changed

package.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
"*": "prettier --ignore-unknown --write"
3838
},
3939
"dependencies": {
40-
"bingo": "^0.5.8",
40+
"bingo": "^0.5.10",
4141
"bingo-fs": "^0.5.4",
4242
"bingo-stratum": "^0.5.7",
4343
"cached-factory": "^0.1.0",
@@ -84,9 +84,9 @@
8484
"@vitest/coverage-v8": "3.0.9",
8585
"@vitest/eslint-plugin": "1.1.38",
8686
"all-contributors-cli": "6.26.1",
87-
"bingo-requests": "0.5.4",
88-
"bingo-stratum-testers": "0.5.6",
89-
"bingo-testers": "0.5.6",
87+
"bingo-requests": "0.5.5",
88+
"bingo-stratum-testers": "0.5.7",
89+
"bingo-testers": "0.5.7",
9090
"console-fail-test": "0.5.0",
9191
"cspell": "8.17.5",
9292
"eslint": "9.22.0",

pnpm-lock.yaml

+44-42
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/base.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -313,4 +313,4 @@ export const base = createBase({
313313
},
314314
});
315315

316-
export type BaseOptions = BaseOptionsFor<typeof base>;
316+
export type BaseOptions = BaseOptionsFor<typeof base> & { preset?: string };

src/blocks/blockCSpell.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ describe("blockCSpell", () => {
280280
"scripts": [
281281
{
282282
"commands": [
283-
"node path/to/cspell-populate-words/bin/index.mjs --words "access" --words "public" --words "description" --words "Test description" --words "directory" --words "." --words "email" --words "github" --words "[email protected]" --words "npm" --words "[email protected]" --words "emoji" --words "💖" --words "owner" --words "test-owner" --words "repository" --words "test-repository" --words "title" --words "Test Title"",
283+
"node path/to/cspell-populate-words/bin/index.mjs --words "access" --words "public" --words "description" --words "Test description" --words "directory" --words "." --words "email" --words "github" --words "[email protected]" --words "npm" --words "[email protected]" --words "emoji" --words "💖" --words "owner" --words "test-owner" --words "preset" --words "minimal" --words "repository" --words "test-repository" --words "title" --words "Test Title"",
284284
],
285285
"phase": 3,
286286
},

src/blocks/blockRepositoryBranchRuleset.test.ts

+40
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,16 @@ describe("blockRepositoryBranchRuleset", () => {
8888
expect(creation).toMatchInlineSnapshot(`
8989
{
9090
"requests": [
91+
{
92+
"endpoint": "DELETE /repos/{owner}/{repo}/branches/{branch}/protection",
93+
"parameters": {
94+
"branch": "main",
95+
"owner": "test-owner",
96+
"repo": "test-repository",
97+
},
98+
"silent": true,
99+
"type": "octokit",
100+
},
91101
{
92102
"endpoint": "POST /repos/{owner}/{repo}/rulesets",
93103
"parameters": {
@@ -244,6 +254,16 @@ describe("blockRepositoryBranchRuleset", () => {
244254
expect(creation).toMatchInlineSnapshot(`
245255
{
246256
"requests": [
257+
{
258+
"endpoint": "DELETE /repos/{owner}/{repo}/branches/{branch}/protection",
259+
"parameters": {
260+
"branch": "main",
261+
"owner": "test-owner",
262+
"repo": "test-repository",
263+
},
264+
"silent": true,
265+
"type": "octokit",
266+
},
247267
{
248268
"endpoint": "POST /repos/{owner}/{repo}/rulesets",
249269
"parameters": {
@@ -320,6 +340,16 @@ describe("blockRepositoryBranchRuleset", () => {
320340
expect(creation).toMatchInlineSnapshot(`
321341
{
322342
"requests": [
343+
{
344+
"endpoint": "DELETE /repos/{owner}/{repo}/branches/{branch}/protection",
345+
"parameters": {
346+
"branch": "main",
347+
"owner": "test-owner",
348+
"repo": "test-repository",
349+
},
350+
"silent": true,
351+
"type": "octokit",
352+
},
323353
{
324354
"endpoint": "POST /repos/{owner}/{repo}/rulesets",
325355
"parameters": {
@@ -399,6 +429,16 @@ describe("blockRepositoryBranchRuleset", () => {
399429
expect(creation).toMatchInlineSnapshot(`
400430
{
401431
"requests": [
432+
{
433+
"endpoint": "DELETE /repos/{owner}/{repo}/branches/{branch}/protection",
434+
"parameters": {
435+
"branch": "main",
436+
"owner": "test-owner",
437+
"repo": "test-repository",
438+
},
439+
"silent": true,
440+
"type": "octokit",
441+
},
402442
{
403443
"endpoint": "PUT /repos/{owner}/{repo}/rulesets/{ruleset_id}",
404444
"parameters": {

src/blocks/blockRepositoryBranchRuleset.ts

+10
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,16 @@ export const blockRepositoryBranchRuleset = base.createBlock({
2828
transition({ addons, options }) {
2929
return {
3030
requests: [
31+
{
32+
endpoint: "DELETE /repos/{owner}/{repo}/branches/{branch}/protection",
33+
parameters: {
34+
branch: "main",
35+
owner: options.owner,
36+
repo: options.repository,
37+
},
38+
silent: true,
39+
type: "octokit",
40+
},
3141
options.rulesetId
3242
? {
3343
endpoint: "PUT /repos/{owner}/{repo}/rulesets/{ruleset_id}",

src/blocks/options.fakes.ts

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ export const optionsBase = {
1010
},
1111
emoji: "💖",
1212
owner: "test-owner",
13+
preset: "minimal",
1314
repository: "test-repository",
1415
title: "Test Title",
1516
} satisfies BaseOptions;

0 commit comments

Comments
 (0)