Skip to content

Commit a626758

Browse files
fix: remove question marks from GHA job names (#1858)
## PR Checklist - [x] Addresses an existing open issue: fixes #1855 - [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 Extracts to a shared helper since there are two places this is relevant. 💖
1 parent a0b7593 commit a626758

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export function createJobName(label: string) {
2+
return label.toLowerCase().replaceAll("?", "").replaceAll(" ", "_");
3+
}

src/steps/writing/creation/dotGitHub/createMultiWorkflowFile.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { createJobName } from "./createJobName.js";
12
import { formatWorkflowYaml } from "./formatWorkflowYaml.js";
23

34
export interface MultiWorkflowFileOptions {
@@ -22,7 +23,7 @@ export function createMultiWorkflowFile({
2223
return formatWorkflowYaml({
2324
jobs: Object.fromEntries(
2425
jobs.map((job) => [
25-
job.name.toLowerCase().replaceAll(" ", "_"),
26+
createJobName(job.name),
2627
{
2728
name: job.name,
2829
"runs-on": "ubuntu-latest",

src/steps/writing/creation/dotGitHub/createSoloWorkflowFile.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { createJobName } from "./createJobName.js";
12
import { formatWorkflowYaml } from "./formatWorkflowYaml.js";
23

34
interface WorkflowFileConcurrency {
@@ -75,7 +76,7 @@ export function createSoloWorkflowFile({
7576
return formatWorkflowYaml({
7677
concurrency,
7778
jobs: {
78-
[name.replaceAll(" ", "_").toLowerCase()]: {
79+
[createJobName(name)]: {
7980
...(options.if && { if: options.if }),
8081
"runs-on": "ubuntu-latest",
8182
steps:

0 commit comments

Comments
 (0)