12
12
- main
13
13
paths :
14
14
- " java/ql/src/utils/model-generator/**/*.*"
15
+ - " .github/workflows/mad_modelDiff.yml"
16
+
17
+ permissions :
18
+ contents : read
15
19
16
20
jobs :
17
21
model-diff :
@@ -26,18 +30,20 @@ jobs:
26
30
# ["FasterXML/jackson-core", "FasterXML/jackson-databind", "google/gson", "JodaOrg/joda-time"
27
31
slug : ${{fromJson(github.event.inputs.projects || '["apache/commons-codec", "apache/commons-io", "apache/commons-beanutils", "apache/commons-logging", "apache/commons-fileupload", "apache/commons-lang", "apache/commons-validator", "apache/commons-csv", "apache/dubbo"]' )}}
28
32
steps :
29
- - name : Clone self ( github/codeql) for prhead
33
+ - name : Clone github/codeql from PR
30
34
uses : actions/checkout@v2
31
35
if : github.event.pull_request
32
36
with :
33
- path : codeql-prhead
34
- ref : ${{ github.base_ref }}
35
- - name : Clone self (github/codeql) with main
37
+ repository : github/codeql
38
+ path : codeql-pr
39
+ ref : ${{ github.sha }}
40
+ - name : Clone github/codeql from main
36
41
uses : actions/checkout@v2
37
42
with :
38
- path : codeql-head
39
- ref : ${{ github.ref }}
40
- - uses : ./codeql-head/.github/actions/fetch-codeql
43
+ repository : github/codeql
44
+ path : codeql-main
45
+ ref : main
46
+ - uses : ./codeql-main/.github/actions/fetch-codeql
41
47
- name : Download database
42
48
env :
43
49
SLUG : ${{ matrix.slug }}
@@ -47,10 +53,10 @@ jobs:
47
53
SHORTNAME=${SLUG//[^a-zA-Z0-9_]/}
48
54
projectId=`curl -s https://lgtm.com/api/v1.0/projects/g/${SLUG} | jq .id`
49
55
curl -L "https://lgtm.com/api/v1.0/snapshots/$projectId/java" -o "$SHORTNAME.zip"
50
- unzip -q -d "$SHORTNAME-db" "$SHORTNAME.zip"
56
+ unzip -q -d "${ SHORTNAME} -db" "${ SHORTNAME} .zip"
51
57
mkdir "lib-dbs/$SHORTNAME/"
52
- mv "$SHORTNAME-db/"` ls -1 "$SHORTNAME-db"` /* "lib-dbs/$SHORTNAME/"
53
- - name : Generate Models (PR and HEAD )
58
+ mv "${ SHORTNAME} -db/"$( ls -1 "${ SHORTNAME}" -db) /* "lib-dbs/${ SHORTNAME} /"
59
+ - name : Generate Models (PR and main )
54
60
run : |
55
61
set -x
56
62
mkdir tmp-models
@@ -63,17 +69,17 @@ jobs:
63
69
cd codeql-$QL_VARIANT
64
70
SHORTNAME=`basename $DATABASE`
65
71
python java/ql/src/utils/model-generator/GenerateFlowModel.py $DATABASE $MODELS/${SHORTNAME}.qll
66
- mv $MODELS/${SHORTNAME}.qll $MODELS/${SHORTNAME}_ ${QL_VARIANT}.qll
72
+ mv $MODELS/${SHORTNAME}.qll $MODELS/${SHORTNAME}Generated_ ${QL_VARIANT}.qll
67
73
cd ..
68
74
}
69
75
70
76
for d in $DATABASES/*/ ; do
71
77
ls -1 "$d"
72
78
73
- analyzeDatabaseWithCheckout "head " $d
79
+ analyzeDatabaseWithCheckout "main " $d
74
80
if [[ "$GITHUB_EVENT_NAME" == "pull_request" ]]
75
81
then
76
- analyzeDatabaseWithCheckout "prhead " $d
82
+ analyzeDatabaseWithCheckout "pr " $d
77
83
fi
78
84
done
79
85
- name : Install diff2html
@@ -85,10 +91,10 @@ jobs:
85
91
set -x
86
92
MODELS=`pwd`/tmp-models
87
93
ls -1 tmp-models/
88
- for m in $MODELS/*_prhead .qll ; do
89
- t="${m/prhead/"head "}"
94
+ for m in $MODELS/*_main .qll ; do
95
+ t="${m/main/"pr "}"
90
96
basename=`basename $m`
91
- name="diff_${basename/_prhead .qll/""}"
97
+ name="diff_${basename/_main .qll/""}"
92
98
(diff -w -u $m $t | diff2html -i stdin -F $MODELS/$name.html) || true
93
99
done
94
100
- uses : actions/upload-artifact@v2
0 commit comments