@@ -14,43 +14,18 @@ outputs:
1414runs :
1515 using : composite
1616 steps :
17- # Cache the query compilation caches.
18- # calculate the merge-base with main, in a way that works both on PRs and pushes to main.
19- - name : Calculate merge-base
20- shell : bash
21- if : ${{ github.event_name == 'pull_request' }}
22- env :
23- BASE_BRANCH : ${{ github.base_ref }}
24- run : |
25- MERGE_BASE=$(git cat-file commit $GITHUB_SHA | grep '^parent ' | head -1 | cut -f 2 -d " ")
26- echo "merge_base=$MERGE_BASE" >> $GITHUB_ENV
27- - name : Read CodeQL query compilation - PR
28- if : ${{ github.event_name == 'pull_request' }}
29- uses : erik-krogh/actions-cache@a88d0603fe5fb5606db9f002dfcadeb32b5f84c6
17+ - name : Cache the query compilation caches
18+ uses : ./.github/actions/incremental-cache
3019 with :
3120 path : ' **/.cache'
32- read-only : true
33- key : codeql-compile-${{ inputs.key }}-pr-${{ github.sha }} # deliberately not using the `compile-compile-main` keys here.
34- restore-keys : |
35- codeql-compile-${{ inputs.key }}-${{ github.base_ref }}-${{ env.merge_base }}
36- codeql-compile-${{ inputs.key }}-${{ github.base_ref }}-
37- codeql-compile-${{ inputs.key }}-main-
38- - name : Fill CodeQL query compilation cache - main
39- if : ${{ github.event_name != 'pull_request' }}
40- uses : erik-krogh/actions-cache@a88d0603fe5fb5606db9f002dfcadeb32b5f84c6
41- with :
42- path : ' **/.cache'
43- key : codeql-compile-${{ inputs.key }}-${{ github.ref_name }}-${{ github.sha }} # just fill on main
44- restore-keys : | # restore from another random commit, to speed up compilation.
45- codeql-compile-${{ inputs.key }}-${{ github.ref_name }}-
46- codeql-compile-${{ inputs.key }}-main-
21+ key : codeql-compile-${{ inputs.key }}
4722 - name : Fill compilation cache directory
4823 id : fill-compilation-dir
49- shell : bash
24+ shell : bash
5025 run : |
5126 # Move all the existing cache into another folder, so we only preserve the cache for the current queries.
5227 node $GITHUB_WORKSPACE/.github/actions/cache-query-compilation/move-caches.js ${COMBINED_CACHE_DIR}
5328
5429 echo "compdir=${COMBINED_CACHE_DIR}" >> $GITHUB_OUTPUT
55- env :
56- COMBINED_CACHE_DIR : ${{ runner.temp }}/compilation-dir
30+ env :
31+ COMBINED_CACHE_DIR : ${{ runner.temp }}/compilation-dir
0 commit comments