@@ -18,12 +18,18 @@ jobs:
18
18
fetch-depth : 0
19
19
# calculate the merge-base with main, in a way that works both on PRs and pushes to main.
20
20
- name : Calculate merge-base
21
- id : merge-base
21
+ if : ${{ github.event_name == 'pull_request' }}
22
22
env :
23
23
BASE_BRANCH : ${{ github.base_ref }}
24
24
run : |
25
25
MERGE_BASE=$(git merge-base --fork-point origin/$BASE_BRANCH)
26
26
echo "merge-base=$MERGE_BASE" >> $GITHUB_ENV
27
+ - name : Calculate merge-base - branch
28
+ if : ${{ github.event_name != 'pull_request' }}
29
+ # using github.sha instead, since we're directly on a branch, and not in a PR
30
+ run : |
31
+ MERGE_BASE=${{ github.sha }})
32
+ echo "merge-base=$MERGE_BASE" >> $GITHUB_ENV
27
33
- name : Cache CodeQL query compilation
28
34
uses : actions/cache@v3
29
35
with :
@@ -41,11 +47,11 @@ jobs:
41
47
run : codeql query format */ql/{src,lib,test}/**/*.{qll,ql} --check-only
42
48
- name : compile queries - check-only
43
49
# run with --check-only if running in a PR (github.sha != main)
44
- if : ${{ github.sha != steps.merge-base.outputs.merge-base }}
50
+ if : ${{ github.event_name == 'pull_request' }}
45
51
shell : bash
46
52
run : codeql query compile -j0 */ql/src --keep-going --warnings=error --check-only
47
53
- name : compile queries - full
48
54
# do full compile if running on main - this populates the cache
49
- if : ${{ github.sha == steps.merge-base.outputs.merge-base }}
55
+ if : ${{ github.event_name != 'pull_request' }}
50
56
shell : bash
51
57
run : codeql query compile -j0 */ql/src --keep-going --warnings=error
0 commit comments