@@ -18,12 +18,18 @@ jobs:
1818 fetch-depth : 0
1919 # calculate the merge-base with main, in a way that works both on PRs and pushes to main.
2020 - name : Calculate merge-base
21- id : merge-base
21+ if : ${{ github.event_name == 'pull_request' }}
2222 env :
2323 BASE_BRANCH : ${{ github.base_ref }}
2424 run : |
2525 MERGE_BASE=$(git merge-base --fork-point origin/$BASE_BRANCH)
2626 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
2733 - name : Cache CodeQL query compilation
2834 uses : actions/cache@v3
2935 with :
@@ -41,11 +47,11 @@ jobs:
4147 run : codeql query format */ql/{src,lib,test}/**/*.{qll,ql} --check-only
4248 - name : compile queries - check-only
4349 # 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' }}
4551 shell : bash
4652 run : codeql query compile -j0 */ql/src --keep-going --warnings=error --check-only
4753 - name : compile queries - full
4854 # 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' }}
5056 shell : bash
5157 run : codeql query compile -j0 */ql/src --keep-going --warnings=error
0 commit comments