@@ -2,10 +2,12 @@ import jsYaml from "js-yaml";
2
2
import { z } from "zod" ;
3
3
4
4
import { base } from "../base.js" ;
5
+ import { resolveUses } from "./actions/resolveUses.js" ;
5
6
import { blockRemoveFiles } from "./blockRemoveFiles.js" ;
6
7
import { blockRepositoryBranchRuleset } from "./blockRepositoryBranchRuleset.js" ;
7
8
import { createMultiWorkflowFile } from "./files/createMultiWorkflowFile.js" ;
8
9
import { createSoloWorkflowFile } from "./files/createSoloWorkflowFile.js" ;
10
+ import { removeUsesQuotes } from "./files/removeUsesQuotes.js" ;
9
11
10
12
export const zActionStep = z . intersection (
11
13
z . object ( {
@@ -33,7 +35,7 @@ export const blockGitHubActionsCI = base.createBlock({
33
35
. optional ( ) ,
34
36
removedWorkflows : z . array ( z . string ( ) ) . optional ( ) ,
35
37
} ,
36
- produce ( { addons } ) {
38
+ produce ( { addons, options } ) {
37
39
const { jobs } = addons ;
38
40
39
41
return {
@@ -46,28 +48,38 @@ export const blockGitHubActionsCI = base.createBlock({
46
48
".github" : {
47
49
actions : {
48
50
prepare : {
49
- "action.yml" : jsYaml
50
- . dump ( {
51
- description : "Prepares the repo for a typical CI job" ,
52
- name : "Prepare" ,
53
- runs : {
54
- steps : [
55
- {
56
- uses : "pnpm/action-setup@v4" ,
57
- } ,
58
- {
59
- uses : "actions/setup-node@v4" ,
60
- with : { cache : "pnpm" , "node-version" : "20" } ,
61
- } ,
62
- {
63
- run : "pnpm install --frozen-lockfile" ,
64
- shell : "bash" ,
65
- } ,
66
- ] ,
67
- using : "composite" ,
68
- } ,
69
- } )
70
- . replaceAll ( / \n ( \S ) / g, "\n\n$1" ) ,
51
+ "action.yml" : removeUsesQuotes (
52
+ jsYaml
53
+ . dump ( {
54
+ description : "Prepares the repo for a typical CI job" ,
55
+ name : "Prepare" ,
56
+ runs : {
57
+ steps : [
58
+ {
59
+ uses : resolveUses (
60
+ "pnpm/action-setup" ,
61
+ "v4" ,
62
+ options . workflowsVersions ,
63
+ ) ,
64
+ } ,
65
+ {
66
+ uses : resolveUses (
67
+ "actions/setup-node" ,
68
+ "v4" ,
69
+ options . workflowsVersions ,
70
+ ) ,
71
+ with : { cache : "pnpm" , "node-version" : "20" } ,
72
+ } ,
73
+ {
74
+ run : "pnpm install --frozen-lockfile" ,
75
+ shell : "bash" ,
76
+ } ,
77
+ ] ,
78
+ using : "composite" ,
79
+ } ,
80
+ } )
81
+ . replaceAll ( / \n ( \S ) / g, "\n\n$1" ) ,
82
+ ) ,
71
83
} ,
72
84
} ,
73
85
workflows : {
@@ -91,7 +103,11 @@ export const blockGitHubActionsCI = base.createBlock({
91
103
} ,
92
104
steps : [
93
105
{
94
- uses : "github/accessibility-alt-text-bot@v1.4.0" ,
106
+ uses : resolveUses (
107
+ "github/accessibility-alt-text-bot" ,
108
+ "v1.4.0" ,
109
+ options . workflowsVersions ,
110
+ ) ,
95
111
} ,
96
112
] ,
97
113
} ) ,
@@ -100,6 +116,7 @@ export const blockGitHubActionsCI = base.createBlock({
100
116
createMultiWorkflowFile ( {
101
117
jobs : jobs . sort ( ( a , b ) => a . name . localeCompare ( b . name ) ) ,
102
118
name : "CI" ,
119
+ workflowsVersions : options . workflowsVersions ,
103
120
} ) ,
104
121
"pr-review-requested.yml" : createSoloWorkflowFile ( {
105
122
name : "PR Review Requested" ,
@@ -113,7 +130,11 @@ export const blockGitHubActionsCI = base.createBlock({
113
130
} ,
114
131
steps : [
115
132
{
116
- uses : "actions-ecosystem/action-remove-labels@v1" ,
133
+ uses : resolveUses (
134
+ "actions-ecosystem/action-remove-labels" ,
135
+ "v1" ,
136
+ options . workflowsVersions ,
137
+ ) ,
117
138
with : {
118
139
labels : "status: waiting for author" ,
119
140
} ,
0 commit comments