Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 49d2fbf

Browse files
author
Benjamin Muskalla
committed
Fixed slug references and PR skips
1 parent 557cb0a commit 49d2fbf

1 file changed

Lines changed: 19 additions & 19 deletions

File tree

.github/workflows/java-model-diff.yml

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ jobs:
1717
model-diff:
1818
name: Model Difference
1919
runs-on: ubuntu-latest
20+
if: github.repository == 'github/codeql'
2021
strategy:
2122
matrix:
2223
# large
@@ -27,6 +28,7 @@ jobs:
2728
steps:
2829
- name: Clone self (github/codeql) for baseline
2930
uses: actions/checkout@v2
31+
if: github.event.pull_request
3032
with:
3133
path: codeql-baseline
3234
ref: ${{ github.base_ref }}
@@ -37,15 +39,17 @@ jobs:
3739
ref: ${{ github.ref }}
3840
- uses: ./codeql-baseline/.github/actions/fetch-codeql
3941
- name: Download database
42+
env:
43+
SLUG: ${{ matrix.slug }}
4044
run: |
4145
set -x
4246
mkdir lib-dbs
4347
SHORTNAME=${SLUG//[^a-zA-Z0-9_]/}
44-
projectId=`curl -s https://lgtm.com/api/v1.0/projects/g/${matrix.slugs}} | jq .id`
45-
curl -L "https://lgtm.com/api/v1.0/snapshots/$projectId/java" -o $SHORTNAME.zip
46-
unzip -q -d $SHORTNAME-db $SHORTNAME.zip
47-
mkdir lib-dbs/$SHORTNAME/
48-
mv $SHORTNAME-db/`ls -1 $SHORTNAME-db`/* lib-dbs/$SHORTNAME/
48+
projectId=`curl -s https://lgtm.com/api/v1.0/projects/g/${SLUG}} | jq .id`
49+
curl -L "https://lgtm.com/api/v1.0/snapshots/$projectId/java" -o "$SHORTNAME.zip"
50+
unzip -q -d $"SHORTNAME-db" "$SHORTNAME.zip"
51+
mkdir "lib-dbs/$SHORTNAME/"
52+
mv "$SHORTNAME-db/"`ls -1 "$SHORTNAME-db"`/* "lib-dbs/$SHORTNAME/"
4953
- name: Generate Models (Baseline and HEAD)
5054
run: |
5155
set -x
@@ -68,7 +72,7 @@ jobs:
6872
ls -1 "$d"
6973
7074
analyzeDatabaseWithCheckout "baseline" $d
71-
if [[ "$s1" != "$s2" ]]
75+
if [[ "$GITHUB_EVENT_NAME" == "pull_request" ]]
7276
then
7377
analyzeDatabaseWithCheckout "head" $d
7478
fi
@@ -77,21 +81,17 @@ jobs:
7781
run: |
7882
npm install -g diff2html-cli
7983
- name: Generate Model Diff
84+
if: github.event.pull_request
8085
run: |
8186
set -x
82-
if [[ "$s1" == "$s2" ]]
83-
then
84-
echo "Skipping diff generation as github.base_ref and github.ref are the same"
85-
else
86-
MODELS=`pwd`/tmp-models
87-
ls -1 tmp-models/
88-
for m in $MODELS/*_baseline.qll ; do
89-
t="${m/baseline/"head"}"
90-
basename=`basename $m`
91-
name="diff_${basename/_baseline.qll/""}"
92-
(diff -w -u $m $t | diff2html -i stdin -F $MODELS/$name.html) || true
93-
done
94-
fi
87+
MODELS=`pwd`/tmp-models
88+
ls -1 tmp-models/
89+
for m in $MODELS/*_baseline.qll ; do
90+
t="${m/baseline/"head"}"
91+
basename=`basename $m`
92+
name="diff_${basename/_baseline.qll/""}"
93+
(diff -w -u $m $t | diff2html -i stdin -F $MODELS/$name.html) || true
94+
done
9595
- uses: actions/upload-artifact@v2
9696
with:
9797
name: models

0 commit comments

Comments
 (0)