@@ -75,7 +75,7 @@ module Actions {
75
75
YamlMapping getJobs ( ) { result = this .lookup ( "jobs" ) }
76
76
77
77
/** Gets the 'global' `env` mapping in this workflow. */
78
- YamlMapping getEnv ( ) { result = this .lookup ( "env" ) }
78
+ WorkflowEnv getEnv ( ) { result = this .lookup ( "env" ) }
79
79
80
80
/** Gets the name of the workflow. */
81
81
string getName ( ) { result = this .lookup ( "name" ) .( YamlString ) .getValue ( ) }
@@ -103,52 +103,36 @@ module Actions {
103
103
Workflow getWorkflow ( ) { result = workflow }
104
104
}
105
105
106
- /** An environment variable in 'env:' */
107
- abstract class EnvVariable extends YamlNode , YamlString {
108
- /** Gets the name of this environment variable. */
109
- abstract string getName ( ) ;
110
- }
106
+ abstract class Env extends YamlNode , YamlMapping { }
111
107
112
- /** A workflow level 'global' environment variable. */
113
- class WorkflowEnvVariable extends EnvVariable {
114
- string envName ;
108
+ /** A workflow level `env` mapping. */
109
+ class WorkflowEnv extends Env {
115
110
Workflow workflow ;
116
111
117
- WorkflowEnvVariable ( ) { this = workflow .getEnv ( ) . lookup ( envName ) }
112
+ WorkflowEnv ( ) { workflow .lookup ( "env" ) = this }
118
113
119
114
/** Gets the workflow this field belongs to. */
120
115
Workflow getWorkflow ( ) { result = workflow }
121
-
122
- /** Gets the name of this environment variable. */
123
- override string getName ( ) { result = envName }
124
116
}
125
117
126
- /** A job level environment variable. */
127
- class JobEnvVariable extends EnvVariable {
128
- string envName ;
118
+ /** A job level `env` mapping. */
119
+ class JobEnv extends Env {
129
120
Job job ;
130
121
131
- JobEnvVariable ( ) { this = job .getEnv ( ) . lookup ( envName ) }
122
+ JobEnv ( ) { job .lookup ( "env" ) = this }
132
123
133
124
/** Gets the job this field belongs to. */
134
125
Job getJob ( ) { result = job }
135
-
136
- /** Gets the name of this environment variable. */
137
- override string getName ( ) { result = envName }
138
126
}
139
127
140
- /** A step level environment variable. */
141
- class StepEnvVariable extends EnvVariable {
142
- string envName ;
128
+ /** A step level `env` mapping. */
129
+ class StepEnv extends Env {
143
130
Step step ;
144
131
145
- StepEnvVariable ( ) { this = step .getEnv ( ) . lookup ( envName ) }
132
+ StepEnv ( ) { step .lookup ( "env" ) = this }
146
133
147
134
/** Gets the step this field belongs to. */
148
135
Step getStep ( ) { result = step }
149
-
150
- /** Gets the name of this environment variable. */
151
- override string getName ( ) { result = envName }
152
136
}
153
137
154
138
/**
@@ -183,7 +167,7 @@ module Actions {
183
167
Step getStep ( int index ) { result .getJob ( ) = this and result .getIndex ( ) = index }
184
168
185
169
/** Gets the `env` mapping in this job. */
186
- YamlMapping getEnv ( ) { result = this .lookup ( "env" ) }
170
+ JobEnv getEnv ( ) { result = this .lookup ( "env" ) }
187
171
188
172
/** Gets the workflow this job belongs to. */
189
173
Workflow getWorkflow ( ) { result = workflow }
@@ -250,7 +234,7 @@ module Actions {
250
234
StepIf getIf ( ) { result .getStep ( ) = this }
251
235
252
236
/** Gets the value of the `env` field in this step, if any. */
253
- YamlMapping getEnv ( ) { result = this .lookup ( "env" ) }
237
+ StepEnv getEnv ( ) { result = this .lookup ( "env" ) }
254
238
255
239
/** Gets the ID of this step, if any. */
256
240
string getId ( ) { result = this .lookup ( "id" ) .( YamlString ) .getValue ( ) }
0 commit comments