Encapsulate composite actions

This commit is contained in:
jarlob
2023-04-14 10:06:35 +02:00
parent 94065764d5
commit d80c541da6
5 changed files with 31 additions and 7 deletions

View File

@@ -28,7 +28,12 @@ module Actions {
* A custom composite action. This is a mapping at the top level of an Actions YAML action file.
* See https://docs.github.com/en/actions/creating-actions/metadata-syntax-for-github-actions.
*/
class Action extends Node, YamlDocument, YamlMapping {
class CompositeAction extends Node, YamlDocument, YamlMapping {
CompositeAction() {
this.getFile().getBaseName() = "action.yml" and
this.lookup("runs").(YamlMapping).lookup("using").(YamlScalar).getValue() = "composite"
}
/** Gets the `runs` mapping. */
Runs getRuns() { result = this.lookup("runs") }
}
@@ -38,12 +43,15 @@ module Actions {
* See https://docs.github.com/en/actions/creating-actions/metadata-syntax-for-github-actions#runs
*/
class Runs extends StepsContainer {
Action action;
CompositeAction action;
Runs() { action.lookup("runs") = this }
/** Gets the action that this `runs` mapping is in. */
Action getAction() { result = action }
CompositeAction getAction() { result = action }
/** Gets the `using` mapping. */
Using getUsing() { result = this.lookup("using") }
}
/**