From 6291bedff867a6555077a083baf624b6ac6f0ea2 Mon Sep 17 00:00:00 2001 From: Josh Goldberg Date: Thu, 16 Jan 2025 13:18:31 -0500 Subject: [PATCH] fix: pass job names from blockGitHubActionCI to blockRepositoryBranchRuleset --- src/next/blocks/blockGitHubActionsCI.test.ts | 26 ++++++++++++++++++++ src/next/blocks/blockGitHubActionsCI.ts | 7 +++++- 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/src/next/blocks/blockGitHubActionsCI.test.ts b/src/next/blocks/blockGitHubActionsCI.test.ts index 4a919901..147192c0 100644 --- a/src/next/blocks/blockGitHubActionsCI.test.ts +++ b/src/next/blocks/blockGitHubActionsCI.test.ts @@ -12,6 +12,14 @@ describe("blockGitHubActionsCI", () => { expect(creation).toMatchInlineSnapshot(` { + "addons": [ + { + "addons": { + "requiredStatusChecks": undefined, + }, + "block": [Function], + }, + ], "files": { ".github": { "actions": { @@ -101,6 +109,14 @@ describe("blockGitHubActionsCI", () => { expect(creation).toMatchInlineSnapshot(` { + "addons": [ + { + "addons": { + "requiredStatusChecks": undefined, + }, + "block": [Function], + }, + ], "files": { ".github": { "actions": { @@ -213,6 +229,16 @@ describe("blockGitHubActionsCI", () => { expect(creation).toMatchInlineSnapshot(` { + "addons": [ + { + "addons": { + "requiredStatusChecks": [ + "Validate", + ], + }, + "block": [Function], + }, + ], "files": { ".github": { "actions": { diff --git a/src/next/blocks/blockGitHubActionsCI.ts b/src/next/blocks/blockGitHubActionsCI.ts index 090708ed..6eb5e1ae 100644 --- a/src/next/blocks/blockGitHubActionsCI.ts +++ b/src/next/blocks/blockGitHubActionsCI.ts @@ -4,6 +4,7 @@ import { z } from "zod"; import { createMultiWorkflowFile } from "../../steps/writing/creation/dotGitHub/createMultiWorkflowFile.js"; import { createSoloWorkflowFile } from "../../steps/writing/creation/dotGitHub/createSoloWorkflowFile.js"; import { base } from "../base.js"; +import { blockRepositoryBranchRuleset } from "./blockRepositoryBranchRuleset.js"; import { CommandPhase } from "./phases.js"; export const zActionStep = z.intersection( @@ -33,7 +34,6 @@ export const blockGitHubActionsCI = base.createBlock({ return { scripts: [ { - silent: true, commands: ["rm -rf .circleci travis.yml"], phase: CommandPhase.Migrations, silent: true, @@ -45,6 +45,11 @@ export const blockGitHubActionsCI = base.createBlock({ const { jobs } = addons; return { + addons: [ + blockRepositoryBranchRuleset({ + requiredStatusChecks: jobs?.map((job) => job.name), + }), + ], files: { ".github": { actions: {