From 1b24b23eb9df4c9e7ff428d1e898f177f29b5d37 Mon Sep 17 00:00:00 2001 From: Shalabh Chaturvedi Date: Mon, 9 Sep 2024 21:00:28 -0700 Subject: [PATCH] Make deps.pex cache repo scoped, so PRs and main commits share deps.pex (#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. --- actions/build_deploy_python_executable/action.yml | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/actions/build_deploy_python_executable/action.yml b/actions/build_deploy_python_executable/action.yml index 8391dba..7e54ce7 100644 --- a/actions/build_deploy_python_executable/action.yml +++ b/actions/build_deploy_python_executable/action.yml @@ -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