Skip to content

Commit 66b9974

Browse files
author
Benjamin Muskalla
committed
Simplify naming pattern
1 parent 4aa0002 commit 66b9974

File tree

1 file changed

+22
-16
lines changed

1 file changed

+22
-16
lines changed

.github/workflows/mad_modelDiff.yml

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ on:
1212
- main
1313
paths:
1414
- "java/ql/src/utils/model-generator/**/*.*"
15+
- ".github/workflows/mad_modelDiff.yml"
16+
17+
permissions:
18+
contents: read
1519

1620
jobs:
1721
model-diff:
@@ -26,18 +30,20 @@ jobs:
2630
# ["FasterXML/jackson-core", "FasterXML/jackson-databind", "google/gson", "JodaOrg/joda-time"
2731
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"]' )}}
2832
steps:
29-
- name: Clone self (github/codeql) for prhead
33+
- name: Clone github/codeql from PR
3034
uses: actions/checkout@v2
3135
if: github.event.pull_request
3236
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
3641
uses: actions/checkout@v2
3742
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
4147
- name: Download database
4248
env:
4349
SLUG: ${{ matrix.slug }}
@@ -47,10 +53,10 @@ jobs:
4753
SHORTNAME=${SLUG//[^a-zA-Z0-9_]/}
4854
projectId=`curl -s https://lgtm.com/api/v1.0/projects/g/${SLUG} | jq .id`
4955
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"
5157
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)
5460
run: |
5561
set -x
5662
mkdir tmp-models
@@ -63,17 +69,17 @@ jobs:
6369
cd codeql-$QL_VARIANT
6470
SHORTNAME=`basename $DATABASE`
6571
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
6773
cd ..
6874
}
6975
7076
for d in $DATABASES/*/ ; do
7177
ls -1 "$d"
7278
73-
analyzeDatabaseWithCheckout "head" $d
79+
analyzeDatabaseWithCheckout "main" $d
7480
if [[ "$GITHUB_EVENT_NAME" == "pull_request" ]]
7581
then
76-
analyzeDatabaseWithCheckout "prhead" $d
82+
analyzeDatabaseWithCheckout "pr" $d
7783
fi
7884
done
7985
- name: Install diff2html
@@ -85,10 +91,10 @@ jobs:
8591
set -x
8692
MODELS=`pwd`/tmp-models
8793
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"}"
9096
basename=`basename $m`
91-
name="diff_${basename/_prhead.qll/""}"
97+
name="diff_${basename/_main.qll/""}"
9298
(diff -w -u $m $t | diff2html -i stdin -F $MODELS/$name.html) || true
9399
done
94100
- uses: actions/upload-artifact@v2

0 commit comments

Comments
 (0)