@@ -31,11 +31,9 @@ class Expression extends Statement { }
3131 * A Github Actions Workflow
3232 */
3333class WorkflowStmt extends Statement instanceof Actions:: Workflow {
34- JobStmt getAJob ( ) { result = super .getJob ( _) }
34+ JobStmt getAJobStmt ( ) { result = super .getJob ( _) }
3535
36- JobStmt getJob ( string id ) { result = super .getJob ( id ) }
37-
38- predicate isReusable ( ) { this instanceof ReusableWorkflowStmt }
36+ JobStmt getJobStmt ( string id ) { result = super .getJob ( id ) }
3937}
4038
4139class ReusableWorkflowStmt extends WorkflowStmt {
@@ -45,15 +43,19 @@ class ReusableWorkflowStmt extends WorkflowStmt {
4543 this .( Actions:: Workflow ) .getOn ( ) .getNode ( "workflow_call" ) = workflow_call
4644 }
4745
48- InputsStmt getInputs ( ) { result = workflow_call .( YamlMapping ) .lookup ( "inputs" ) }
46+ ReusableWorkflowInputsStmt getInputsStmt ( ) {
47+ result = workflow_call .( YamlMapping ) .lookup ( "inputs" )
48+ }
4949
50- OutputsStmt getOutputs ( ) { result = workflow_call .( YamlMapping ) .lookup ( "outputs" ) }
50+ ReusableWorkflowOutputsStmt getOutputsStmt ( ) {
51+ result = workflow_call .( YamlMapping ) .lookup ( "outputs" )
52+ }
5153
5254 string getName ( ) { result = this .getLocation ( ) .getFile ( ) .getRelativePath ( ) }
5355}
5456
55- class InputsStmt extends Statement instanceof YamlMapping {
56- InputsStmt ( ) {
57+ class ReusableWorkflowInputsStmt extends Statement instanceof YamlMapping {
58+ ReusableWorkflowInputsStmt ( ) {
5759 exists ( Actions:: On on | on .getNode ( "workflow_call" ) .( YamlMapping ) .lookup ( "inputs" ) = this )
5860 }
5961
@@ -70,16 +72,16 @@ class InputsStmt extends Statement instanceof YamlMapping {
7072 * token:
7173 * required: true
7274 */
73- InputExpr getInputExpr ( string name ) {
75+ ReusableWorkflowInputExpr getInputExpr ( string name ) {
7476 result .( YamlString ) .getValue ( ) = name and
7577 this .( YamlMapping ) .maps ( result , _)
7678 }
7779}
7880
79- class InputExpr extends Expression instanceof YamlString { }
81+ class ReusableWorkflowInputExpr extends Expression instanceof YamlString { }
8082
81- class OutputsStmt extends Statement instanceof YamlMapping {
82- OutputsStmt ( ) {
83+ class ReusableWorkflowOutputsStmt extends Statement instanceof YamlMapping {
84+ ReusableWorkflowOutputsStmt ( ) {
8385 exists ( Actions:: On on | on .getNode ( "workflow_call" ) .( YamlMapping ) .lookup ( "outputs" ) = this )
8486 }
8587
@@ -96,12 +98,12 @@ class OutputsStmt extends Statement instanceof YamlMapping {
9698 * description: "The second output string"
9799 * value: ${{ jobs.example_job.outputs.output2 }}
98100 */
99- OutputExpr getOutputExpr ( string name ) {
101+ ReusableWorkflowOutputExpr getOutputExpr ( string name ) {
100102 this .( YamlMapping ) .lookup ( name ) .( YamlMapping ) .lookup ( "value" ) = result
101103 }
102104}
103105
104- class OutputExpr extends Expression instanceof YamlString { }
106+ class ReusableWorkflowOutputExpr extends Expression instanceof YamlString { }
105107
106108/**
107109 * A Job is a collection of steps that run in an execution environment.
@@ -114,10 +116,10 @@ class JobStmt extends Statement instanceof Actions::Job {
114116 string getId ( ) { result = super .getId ( ) }
115117
116118 /** Gets the step at the given index within this job. */
117- StepStmt getStep ( int index ) { result = super .getStep ( index ) }
119+ StepStmt getStepStmt ( int index ) { result = super .getStep ( index ) }
118120
119121 /** Gets any steps that are defined within this job. */
120- StepStmt getAStep ( ) { result = super .getStep ( _) }
122+ StepStmt getAStepStmt ( ) { result = super .getStep ( _) }
121123
122124 /**
123125 * Gets a needed job.
@@ -147,7 +149,7 @@ class JobStmt extends Statement instanceof Actions::Job {
147149 * with:
148150 * arg1: value1
149151 */
150- JobUsesExpr getUsesExpr ( ) { result .getJob ( ) = this }
152+ JobUsesExpr getUsesExpr ( ) { result .getJobStmt ( ) = this }
151153}
152154
153155/**
@@ -178,7 +180,7 @@ class JobOutputStmt extends Statement instanceof YamlMapping {
178180class StepStmt extends Statement instanceof Actions:: Step {
179181 string getId ( ) { result = super .getId ( ) }
180182
181- JobStmt getJob ( ) { result = super .getJob ( ) }
183+ JobStmt getJobStmt ( ) { result = super .getJob ( ) }
182184}
183185
184186/**
@@ -189,7 +191,7 @@ abstract class UsesExpr extends Expression {
189191
190192 abstract string getVersion ( ) ;
191193
192- abstract Expression getArgument ( string key ) ;
194+ abstract Expression getArgumentExpr ( string key ) ;
193195}
194196
195197/**
@@ -204,7 +206,7 @@ class StepUsesExpr extends StepStmt, UsesExpr {
204206
205207 override string getVersion ( ) { result = uses .getVersion ( ) }
206208
207- override Expression getArgument ( string key ) {
209+ override Expression getArgumentExpr ( string key ) {
208210 exists ( Actions:: With with |
209211 with .getStep ( ) = this and
210212 result = with .lookup ( key )
@@ -220,7 +222,7 @@ class JobUsesExpr extends UsesExpr instanceof YamlMapping {
220222 this instanceof JobStmt and this .maps ( any ( YamlString s | s .getValue ( ) = "uses" ) , _)
221223 }
222224
223- JobStmt getJob ( ) { result = this }
225+ JobStmt getJobStmt ( ) { result = this }
224226
225227 /**
226228 * Gets a regular expression that parses an `owner/repo@version` reference within a `uses` field in an Actions job step.
@@ -255,7 +257,7 @@ class JobUsesExpr extends UsesExpr instanceof YamlMapping {
255257 )
256258 }
257259
258- override Expression getArgument ( string key ) {
260+ override Expression getArgumentExpr ( string key ) {
259261 this .( YamlMapping ) .lookup ( "with" ) .( YamlMapping ) .lookup ( key ) = result
260262 }
261263}
@@ -290,8 +292,7 @@ class ExprAccessExpr extends Expression instanceof YamlString {
290292
291293 string getExpression ( ) { result = expr }
292294
293- JobStmt getJob ( ) { result .getAChildNode * ( ) = this }
294- //override string toString() { result = expr }
295+ JobStmt getJobStmt ( ) { result .getAChildNode * ( ) = this }
295296}
296297
297298/**
@@ -313,7 +314,7 @@ class StepOutputAccessExpr extends ExprAccessExpr {
313314
314315 string getVarName ( ) { result = varName }
315316
316- StepStmt getStep ( ) { result .getId ( ) = stepId }
317+ StepStmt getStepStmt ( ) { result .getId ( ) = stepId }
317318}
318319
319320/**
@@ -368,7 +369,7 @@ class ReusableWorkflowInputAccessExpr extends ExprAccessExpr {
368369 Expression getInputExpr ( ) {
369370 exists ( ReusableWorkflowStmt w |
370371 w .getLocation ( ) .getFile ( ) = this .getLocation ( ) .getFile ( ) and
371- w .getInputs ( ) .getInputExpr ( paramName ) = result
372+ w .getInputsStmt ( ) .getInputExpr ( paramName ) = result
372373 )
373374 }
374375}
0 commit comments