@@ -70,7 +70,7 @@ class DataFlowExpr extends Cfg::Node {
70
70
}
71
71
72
72
/**
73
- * A call corresponds to a Uses steps where a local action, 3rd party action or a reusable workflow get called
73
+ * A call corresponds to a Uses steps where a composite action or a reusable workflow get called
74
74
*/
75
75
class DataFlowCall instanceof Cfg:: Node {
76
76
DataFlowCall ( ) { super .getAstNode ( ) instanceof Uses }
@@ -89,46 +89,15 @@ class DataFlowCall instanceof Cfg::Node {
89
89
Location getLocation ( ) { result = this .( Cfg:: Node ) .getLocation ( ) }
90
90
}
91
91
92
- string getRepoRoot ( ) {
93
- exists ( Workflow w |
94
- w .getLocation ( ) .getFile ( ) .getRelativePath ( ) .indexOf ( "/.github/workflows" ) > 0 and
95
- result =
96
- w .getLocation ( )
97
- .getFile ( )
98
- .getRelativePath ( )
99
- .prefix ( w .getLocation ( ) .getFile ( ) .getRelativePath ( ) .indexOf ( "/.github/workflows" ) + 1 ) and
100
- // exclude workflow_enum reusable workflows directory root
101
- not result .indexOf ( ".github/reusable_workflows/" ) > - 1
102
- or
103
- not w .getLocation ( ) .getFile ( ) .getRelativePath ( ) .indexOf ( "/.github/workflows" ) > 0 and
104
- not w .getLocation ( ) .getFile ( ) .getRelativePath ( ) .indexOf ( ".github/reusable_workflows" ) > - 1 and
105
- result = ""
106
- )
107
- }
108
-
109
92
/**
110
93
* A Cfg scope that can be called
111
94
*/
112
95
class DataFlowCallable instanceof Cfg:: CfgScope {
113
96
string toString ( ) { result = super .toString ( ) }
114
97
115
98
string getName ( ) {
116
- if this instanceof ReusableWorkflow
117
- then result = this .( ReusableWorkflow ) .getLocation ( ) .getFile ( ) .getRelativePath ( ) // or
118
- else
119
- if this instanceof CompositeAction
120
- then
121
- result =
122
- this .( CompositeAction )
123
- .getLocation ( )
124
- .getFile ( )
125
- .getRelativePath ( )
126
- .prefix ( this .( CompositeAction )
127
- .getLocation ( )
128
- .getFile ( )
129
- .getRelativePath ( )
130
- .indexOf ( [ "/action.yml" , "/action.yaml" ] ) )
131
- else none ( )
99
+ result = this .( ReusableWorkflowImpl ) .getResolvedPath ( ) or
100
+ result = this .( CompositeActionImpl ) .getResolvedPath ( )
132
101
}
133
102
134
103
/** Gets a best-effort total ordering. */
@@ -150,13 +119,7 @@ class NormalReturn extends ReturnKind, TNormalReturn {
150
119
}
151
120
152
121
/** Gets a viable implementation of the target of the given `Call`. */
153
- DataFlowCallable viableCallable ( DataFlowCall c ) {
154
- c .getName ( ) = result .getName ( ) or
155
- c .getName ( ) = result .getName ( ) .replaceAll ( getRepoRoot ( ) , "" ) or
156
- // special case for reusable workflows downloaded by the workflow_enum action
157
- c .getName ( ) =
158
- result .getName ( ) .replaceAll ( getRepoRoot ( ) , "" ) .replaceAll ( ".github/reusable_workflows/" , "" )
159
- }
122
+ DataFlowCallable viableCallable ( DataFlowCall c ) { c .getName ( ) = result .getName ( ) }
160
123
161
124
/**
162
125
* Gets a node that can read the value returned from `call` with return kind
0 commit comments