@@ -5,6 +5,14 @@ import * as path from "path";
55
66import * as yaml from "yaml" ;
77
8+ /** Known workflow input names. */
9+ enum KnownInputName {
10+ GoVersion = "go-version" ,
11+ JavaVersion = "java-version" ,
12+ PythonVersion = "python-version" ,
13+ DotnetVersion = "dotnet-version" ,
14+ }
15+
816/**
917 * Represents workflow input definitions.
1018 */
@@ -15,6 +23,9 @@ interface WorkflowInput {
1523 default : string ;
1624}
1725
26+ /** A partial mapping from known input names to input definitions. */
27+ type WorkflowInputs = Partial < Record < KnownInputName , WorkflowInput > > ;
28+
1829/**
1930 * Represents PR check specifications.
2031 */
@@ -155,11 +166,7 @@ function main(): void {
155166
156167 console . log ( `Processing: ${ checkName } — "${ checkSpecification . name } "` ) ;
157168
158- let workflowInputs : Record < string , WorkflowInput > = { } ;
159- if ( checkSpecification . inputs ) {
160- workflowInputs = checkSpecification . inputs ;
161- }
162-
169+ const workflowInputs : WorkflowInputs = { } ;
163170 let matrix : Array < Record < string , any > > = [ ] ;
164171
165172 for ( const version of checkSpecification . versions ?? defaultTestVersions ) {
@@ -249,7 +256,7 @@ function main(): void {
249256
250257 if ( installGo ) {
251258 const baseGoVersionExpr = ">=1.21.0" ;
252- workflowInputs [ "go-version" ] = {
259+ workflowInputs [ KnownInputName . GoVersion ] = {
253260 type : "string" ,
254261 description : "The version of Go to install" ,
255262 required : false ,
@@ -273,7 +280,7 @@ function main(): void {
273280
274281 if ( installJava ) {
275282 const baseJavaVersionExpr = "17" ;
276- workflowInputs [ "java-version" ] = {
283+ workflowInputs [ KnownInputName . JavaVersion ] = {
277284 type : "string" ,
278285 description : "The version of Java to install" ,
279286 required : false ,
@@ -295,7 +302,7 @@ function main(): void {
295302
296303 if ( installPython ) {
297304 const basePythonVersionExpr = "3.13" ;
298- workflowInputs [ "python-version" ] = {
305+ workflowInputs [ KnownInputName . PythonVersion ] = {
299306 type : "string" ,
300307 description : "The version of Python to install" ,
301308 required : false ,
@@ -317,7 +324,7 @@ function main(): void {
317324
318325 if ( installDotNet ) {
319326 const baseDotNetVersionExpr = "9.x" ;
320- workflowInputs [ "dotnet-version" ] = {
327+ workflowInputs [ KnownInputName . DotnetVersion ] = {
321328 type : "string" ,
322329 description : "The version of .NET to install" ,
323330 required : false ,
0 commit comments