@@ -5,6 +5,8 @@ import * as path from "path";
55
66import * as yaml from "yaml" ;
77
8+ import { ACTION_VERSIONS } from "./action-versions" ;
9+
810/** Known workflow input names. */
911enum KnownInputName {
1012 GoVersion = "go-version" ,
@@ -13,6 +15,9 @@ enum KnownInputName {
1315 DotnetVersion = "dotnet-version" ,
1416}
1517
18+ /** Known Action names that we have version information for. */
19+ type KnownAction = keyof typeof ACTION_VERSIONS ;
20+
1621/**
1722 * Represents workflow input definitions.
1823 */
@@ -94,6 +99,12 @@ const THIS_DIR = __dirname;
9499const CHECKS_DIR = path . join ( THIS_DIR , "checks" ) ;
95100const OUTPUT_DIR = path . join ( THIS_DIR , ".." , ".github" , "workflows" ) ;
96101
102+ /** Gets an `actionName@ref` string for `actionName`. */
103+ function getActionRef ( actionName : KnownAction ) : string {
104+ const versionInfo = ACTION_VERSIONS [ actionName ] ;
105+ return `${ actionName } @${ versionInfo . version } ` ;
106+ }
107+
97108/**
98109 * Loads and parses a YAML file.
99110 */
@@ -216,7 +227,7 @@ function main(): void {
216227 const steps : any [ ] = [
217228 {
218229 name : "Check out repository" ,
219- uses : "actions/checkout@v6" ,
230+ uses : getActionRef ( "actions/checkout" ) ,
220231 } ,
221232 ] ;
222233
@@ -226,7 +237,7 @@ function main(): void {
226237 steps . push (
227238 {
228239 name : "Install Node.js" ,
229- uses : "actions/setup-node@v6" ,
240+ uses : getActionRef ( "actions/setup-node" ) ,
230241 with : {
231242 "node-version" : "20.x" ,
232243 cache : "npm" ,
@@ -265,7 +276,7 @@ function main(): void {
265276
266277 steps . push ( {
267278 name : "Install Go" ,
268- uses : "actions/setup-go@v6" ,
279+ uses : getActionRef ( "actions/setup-go" ) ,
269280 with : {
270281 "go-version" :
271282 "${{ inputs.go-version || '" + baseGoVersionExpr + "' }}" ,
@@ -289,7 +300,7 @@ function main(): void {
289300
290301 steps . push ( {
291302 name : "Install Java" ,
292- uses : "actions/setup-java@v5" ,
303+ uses : getActionRef ( "actions/setup-java" ) ,
293304 with : {
294305 "java-version" :
295306 "${{ inputs.java-version || '" + baseJavaVersionExpr + "' }}" ,
@@ -312,7 +323,7 @@ function main(): void {
312323 steps . push ( {
313324 name : "Install Python" ,
314325 if : "matrix.version != 'nightly-latest'" ,
315- uses : "actions/setup-python@v6" ,
326+ uses : getActionRef ( "actions/setup-python" ) ,
316327 with : {
317328 "python-version" :
318329 "${{ inputs.python-version || '" + basePythonVersionExpr + "' }}" ,
@@ -333,7 +344,7 @@ function main(): void {
333344
334345 steps . push ( {
335346 name : "Install .NET" ,
336- uses : "actions/setup-dotnet@v5" ,
347+ uses : getActionRef ( "actions/setup-dotnet" ) ,
337348 with : {
338349 "dotnet-version" :
339350 "${{ inputs.dotnet-version || '" + baseDotNetVersionExpr + "' }}" ,
0 commit comments