Skip to content

Commit f93ba85

Browse files
authored
Make cache key reproducible for other repositories (#40)
1 parent e88669a commit f93ba85

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

action.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -339,16 +339,21 @@ runs:
339339
echo "release=${DISTRIB_RELEASE}" >> $GITHUB_OUTPUT
340340
echo "codename=${DISTRIB_CODENAME}" >> $GITHUB_OUTPUT
341341
echo "description=${DISTRIB_DESCRIPTION}" >> $GITHUB_OUTPUT
342-
echo "id-release=${DISTRIB_ID}-${DISTRIB_DESCRIPTION}" >> $GITHUB_OUTPUT
342+
echo "id-release=${DISTRIB_ID}-${DISTRIB_RELEASE}" >> $GITHUB_OUTPUT
343343
echo "arch=$(uname -m)" >> $GITHUB_OUTPUT
344344
elif [ "$RUNNER_OS" == "macOS" ]; then
345345
echo "id-release=macOS-$(sw_vers -productVersion)" >> $GITHUB_OUTPUT
346346
echo "arch=$(uname -m)" >> $GITHUB_OUTPUT
347347
fi
348+
# Create an envvar that stores information about the action version used
349+
ACTION_VERSION=$(basename "$GITHUB_ACTION_PATH")
350+
ACTION_NAME=$(basename $(dirname "$GITHUB_ACTION_PATH"))
351+
ACTION_OWNER=$(basename $(dirname $(dirname "$GITHUB_ACTION_PATH")))
352+
echo "cvmfs_action_version=${ACTION_OWNER}_${ACTION_NAME}_${ACTION_VERSION}" >> $GITHUB_OUTPUT
348353
shell: bash
349354
- uses: actions/cache@v4
350355
with:
351-
key: cvmfs-apt-cache-${{ steps.lsb-release.outputs.id-release }}-${{ steps.lsb-release.outputs.arch }}-${{ hashFiles('action.yml') }}
356+
key: cvmfs-apt-cache-${{ steps.lsb-release.outputs.id-release }}-${{ steps.lsb-release.outputs.arch }}-${{ steps.lsb-release.outputs.cvmfs_action_version }}
352357
path: |
353358
${{ inputs.apt_cache }}
354359
- run: |

0 commit comments

Comments
 (0)