Skip to content

Commit a2619f6

Browse files
committed
Internal queries: Replace deprecated predicates
1 parent 65c7496 commit a2619f6

File tree

2 files changed

+10
-21
lines changed

2 files changed

+10
-21
lines changed

‎queries/required-action-input.ql‎

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -19,37 +19,26 @@ class ActionDeclaration extends File{
1919
getRelativePath().matches("%/action.yml")
2020
}
2121

22-
YAMLDocumentgetRootNode(){
22+
YamlDocumentgetRootNode(){
2323
result.getFile()=this
2424
}
2525

2626
/**
2727
* The name of any input to this action.
2828
*/
2929
stringgetAnInput(){
30-
result=getRootNode().(YAMLMapping).lookup("inputs").(YAMLMapping).getKey(_).(YAMLString).getValue()
30+
result=getRootNode().(YamlMapping).lookup("inputs").(YamlMapping).getKey(_).(YamlString).getValue()
3131
}
3232

3333
/**
3434
* The given input always has a value, either because it is required,
3535
* or because it has a default value.
3636
*/
3737
predicateinputAlwaysHasValue(stringinput){
38-
exists(YAMLMappingvalue|
39-
value=getRootNode().(YAMLMapping).lookup("inputs").(YAMLMapping).lookup(input)and
38+
exists(YamlMappingvalue|
39+
value=getRootNode().(YamlMapping).lookup("inputs").(YamlMapping).lookup(input)and
4040
(exists(value.lookup("default"))or
41-
value.lookup("required").(YAMLBool).getBoolValue()=true))
42-
}
43-
44-
/**
45-
* The function that is the entrypoint to this action.
46-
*/
47-
FunctionDeclStmtgetEntrypoint(){
48-
result.getFile().getRelativePath()=getRootNode().
49-
(YAMLMapping).lookup("runs").
50-
(YAMLMapping).lookup("main").
51-
(YAMLString).getValue().regexpReplaceAll("\\.\\./lib/(.*)\\.js","src/$1.ts")and
52-
result.getName()="run"
41+
value.lookup("required").(YamlBool).getBoolValue()=true))
5342
}
5443
}
5544

‎queries/undeclared-action-input.ql‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,25 +24,25 @@ class ActionDeclaration extends File{
2424
result=getRelativePath().regexpCapture("(.*)/action.yml",1)
2525
}
2626

27-
YAMLDocumentgetRootNode(){
27+
YamlDocumentgetRootNode(){
2828
result.getFile()=this
2929
}
3030

3131
/**
3232
* The name of any input to this action.
3333
*/
3434
stringgetAnInput(){
35-
result=getRootNode().(YAMLMapping).lookup("inputs").(YAMLMapping).getKey(_).(YAMLString).getValue()
35+
result=getRootNode().(YamlMapping).lookup("inputs").(YamlMapping).getKey(_).(YamlString).getValue()
3636
}
3737

3838
/**
3939
* The function that is the entrypoint to this action.
4040
*/
4141
FunctionDeclStmtgetEntrypoint(){
4242
result.getFile().getRelativePath()=getRootNode().
43-
(YAMLMapping).lookup("runs").
44-
(YAMLMapping).lookup("main").
45-
(YAMLString).getValue().regexpReplaceAll("\\.\\./lib/(.*)\\.js","src/$1.ts")and
43+
(YamlMapping).lookup("runs").
44+
(YamlMapping).lookup("main").
45+
(YamlString).getValue().regexpReplaceAll("\\.\\./lib/(.*)\\.js","src/$1.ts")and
4646
result.getName()="run"
4747
}
4848
}

0 commit comments

Comments
(0)