Skip to content

Commit

Permalink
Make deps.pex cache repo scoped, so PRs and main commits share deps.p…
Browse files Browse the repository at this point in the history
…ex (#197)

* Dont reuse the full deployment deps cache in PRs

This means the first PR action will rebuild the deps, however all subsequent PRs will be able to reuse the deps. 

If a PR changes deps then it will also get cached. Previous changing deps in a PR would rebuild the deps on each deploy.
  • Loading branch information
shalabhc authored Sep 10, 2024
1 parent 8dfef76 commit 1b24b23
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions actions/build_deploy_python_executable/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,11 @@ runs:
- name: Set deps-cache-from
# Don't use cached deps if instructed
if: ${{ inputs.force_rebuild_deps != 'true' }}
# For PR commits, use the target branch name as the cache-tag, for other commits, use the branch name itself
run: echo "FLAG_DEPS_CACHE_FROM=--deps-cache-from=${{ github.repository }}/${{ github.base_ref && github.base_ref || github.ref_name }}" >> $GITHUB_ENV
run: echo "FLAG_DEPS_CACHE_FROM=--deps-cache-from=${{ github.repository }}" >> $GITHUB_ENV
shell: bash

- name: Set deps-cache-to
# Only write to the cache-tag for non PR commits so PR commits don't upgrade dependency versions
if: ${{ github.base_ref == '' }}
run: echo "FLAG_DEPS_CACHE_TO=--deps-cache-to=${{ github.repository }}/${{ github.ref_name }}" >> $GITHUB_ENV
run: echo "FLAG_DEPS_CACHE_TO=--deps-cache-to=${{ github.repository }}" >> $GITHUB_ENV
shell: bash

- name: Set up Python 3.8
Expand Down

0 comments on commit 1b24b23

Please sign in to comment.