@@ -4,6 +4,7 @@ import path from "path";
44import test , { ExecutionContext } from "ava" ;
55import * as sinon from "sinon" ;
66
7+ import * as actionsUtil from "./actions-util" ;
78import { createStubCodeQL } from "./codeql" ;
89import { EnvVar } from "./environment" ;
910import {
@@ -28,6 +29,7 @@ test("checkWorkflow - validates workflow if `SKIP_WORKFLOW_VALIDATION` is not se
2829 const messages : LoggedMessage [ ] = [ ] ;
2930 const codeql = createStubCodeQL ( { } ) ;
3031
32+ sinon . stub ( actionsUtil , "isDynamicWorkflow" ) . returns ( false ) ;
3133 const validateWorkflow = sinon . stub ( workflow , "validateWorkflow" ) ;
3234 validateWorkflow . resolves ( undefined ) ;
3335
@@ -46,6 +48,7 @@ test("checkWorkflow - logs problems with workflow validation", async (t) => {
4648 const messages : LoggedMessage [ ] = [ ] ;
4749 const codeql = createStubCodeQL ( { } ) ;
4850
51+ sinon . stub ( actionsUtil , "isDynamicWorkflow" ) . returns ( false ) ;
4952 const validateWorkflow = sinon . stub ( workflow , "validateWorkflow" ) ;
5053 validateWorkflow . resolves ( "problem" ) ;
5154
@@ -66,6 +69,7 @@ test("checkWorkflow - skips validation if `SKIP_WORKFLOW_VALIDATION` is `true`",
6669 const messages : LoggedMessage [ ] = [ ] ;
6770 const codeql = createStubCodeQL ( { } ) ;
6871
72+ sinon . stub ( actionsUtil , "isDynamicWorkflow" ) . returns ( false ) ;
6973 const validateWorkflow = sinon . stub ( workflow , "validateWorkflow" ) ;
7074
7175 await checkWorkflow ( getRecordingLogger ( messages ) , codeql ) ;
@@ -77,6 +81,25 @@ test("checkWorkflow - skips validation if `SKIP_WORKFLOW_VALIDATION` is `true`",
7781 t . is ( messages . length , 0 ) ;
7882} ) ;
7983
84+ test ( "checkWorkflow - skips validation for `dynamic` workflows" , async ( t ) => {
85+ const messages : LoggedMessage [ ] = [ ] ;
86+ const codeql = createStubCodeQL ( { } ) ;
87+
88+ const isDynamicWorkflow = sinon
89+ . stub ( actionsUtil , "isDynamicWorkflow" )
90+ . returns ( true ) ;
91+ const validateWorkflow = sinon . stub ( workflow , "validateWorkflow" ) ;
92+
93+ await checkWorkflow ( getRecordingLogger ( messages ) , codeql ) ;
94+
95+ t . assert ( isDynamicWorkflow . calledOnce ) ;
96+ t . assert (
97+ validateWorkflow . notCalled ,
98+ "`checkWorkflow` called `validateWorkflow` unexpectedly" ,
99+ ) ;
100+ t . is ( messages . length , 0 ) ;
101+ } ) ;
102+
80103test ( "cleanupDatabaseClusterDirectory cleans up where possible" , async ( t ) => {
81104 await withTmpDir ( async ( tmpDir : string ) => {
82105 const dbLocation = path . resolve ( tmpDir , "dbs" ) ;
0 commit comments