Skip to content

Commit

Permalink
fix: pass job names from blockGitHubActionCI to blockRepositoryBranch…
Browse files Browse the repository at this point in the history
…Ruleset (#1891)

## PR Checklist

- [x] Addresses an existing open issue: fixes #1887
- [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

💖
  • Loading branch information
JoshuaKGoldberg authored Jan 16, 2025
1 parent 5ac2ebe commit d0ff0fc
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
26 changes: 26 additions & 0 deletions src/next/blocks/blockGitHubActionsCI.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@ describe("blockGitHubActionsCI", () => {

expect(creation).toMatchInlineSnapshot(`
{
"addons": [
{
"addons": {
"requiredStatusChecks": undefined,
},
"block": [Function],
},
],
"files": {
".github": {
"actions": {
Expand Down Expand Up @@ -101,6 +109,14 @@ describe("blockGitHubActionsCI", () => {

expect(creation).toMatchInlineSnapshot(`
{
"addons": [
{
"addons": {
"requiredStatusChecks": undefined,
},
"block": [Function],
},
],
"files": {
".github": {
"actions": {
Expand Down Expand Up @@ -213,6 +229,16 @@ describe("blockGitHubActionsCI", () => {

expect(creation).toMatchInlineSnapshot(`
{
"addons": [
{
"addons": {
"requiredStatusChecks": [
"Validate",
],
},
"block": [Function],
},
],
"files": {
".github": {
"actions": {
Expand Down
6 changes: 6 additions & 0 deletions src/next/blocks/blockGitHubActionsCI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -44,6 +45,11 @@ export const blockGitHubActionsCI = base.createBlock({
const { jobs } = addons;

return {
addons: [
blockRepositoryBranchRuleset({
requiredStatusChecks: jobs?.map((job) => job.name),
}),
],
files: {
".github": {
actions: {
Expand Down

0 comments on commit d0ff0fc

Please sign in to comment.