@@ -90,7 +90,7 @@ interface Specification extends JobSpecification {
9090 services ?: any ;
9191
9292 /** Additional jobs to run after the main PR check job. */
93- validationJobs ?: Record < string , JobSpecification > ;
93+ validationJobs ?: Record < string , ValidationJobSpecification > ;
9494
9595 /** If set, this check is part of a named collection that gets its own caller workflow. */
9696 collection ?: string ;
@@ -122,6 +122,10 @@ interface JobSpecification {
122122 installYq ?: boolean ;
123123}
124124
125+ type ValidationJobSpecification = JobSpecification & {
126+ checkout ?: boolean ;
127+ } ;
128+
125129/** Describes language/framework-specific steps and inputs. */
126130interface LanguageSetup {
127131 specProperty : keyof JobSpecification ;
@@ -462,6 +466,20 @@ function generateJobMatrix(
462466 return matrix ;
463467}
464468
469+ /**
470+ * Gets the `actions/checkout` step.
471+ */
472+ function getCheckoutStep ( ) : Step {
473+ return {
474+ name : "Check out repository" ,
475+ uses : pinnedUses (
476+ "actions/checkout" ,
477+ "3d3c42e5aac5ba805825da76410c181273ba90b1" ,
478+ "v7.0.1" ,
479+ ) ,
480+ } ;
481+ }
482+
465483/**
466484 * Retrieves setup steps and additional input definitions based on specific languages or frameworks
467485 * that are requested by the `checkSpecification`.
@@ -531,14 +549,7 @@ function generateJob(
531549
532550 // Construct the workflow steps needed for this check.
533551 const steps : Step [ ] = [
534- {
535- name : "Check out repository" ,
536- uses : pinnedUses (
537- "actions/checkout" ,
538- "3d3c42e5aac5ba805825da76410c181273ba90b1" ,
539- "v7.0.1" ,
540- ) ,
541- } ,
552+ getCheckoutStep ( ) ,
542553 ...setupInfo . steps ,
543554 {
544555 name : "Prepare test" ,
@@ -609,13 +620,16 @@ function generateJob(
609620/** Generates a validation job. */
610621function generateValidationJob (
611622 specDocument : yaml . Document ,
612- jobSpecification : JobSpecification ,
623+ jobSpecification : ValidationJobSpecification ,
613624 checkName : string ,
614625 name : string ,
615626) {
616627 // Determine which languages or frameworks have to be installed.
617628 const { inputs, steps } = getSetupSteps ( jobSpecification ) ;
618629
630+ // Construct a checkout step if requested.
631+ const checkoutStep = jobSpecification . checkout ? [ getCheckoutStep ( ) ] : [ ] ;
632+
619633 // Extract the sequence of steps from the YAML document to persist as much formatting as possible.
620634 const specSteps = specDocument . getIn ( [
621635 "validationJobs" ,
@@ -624,7 +638,7 @@ function generateValidationJob(
624638 ] ) as yaml . YAMLSeq ;
625639
626640 // Add the generated steps in front of the ones from the specification.
627- specSteps . items . unshift ( ...steps ) ;
641+ specSteps . items . unshift ( ...checkoutStep , ... steps ) ;
628642
629643 const validationJob : Record < string , any > = {
630644 name : jobSpecification . name ,
@@ -635,7 +649,7 @@ function generateValidationJob(
635649 "security-events" : "read" ,
636650 } ,
637651 "timeout-minutes" : 5 ,
638- "runs-on" : "ubuntu-slim " ,
652+ "runs-on" : "ubuntu-latest " ,
639653 steps : specSteps ,
640654 } ;
641655
0 commit comments