Skip to content

Commit

Permalink
fix: include more tool paths in the cache slug for pre-commit action …
Browse files Browse the repository at this point in the history
…runs (#1)
  • Loading branch information
Roguelazer authored Jun 14, 2024
1 parent f7acafa commit 90eae0c
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
7 changes: 6 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
- uses: actions/setup-python@v5
with:
python-version: '3.12'
- uses: ruby/setup-ruby@v1
with:
ruby-version: '3.3'
- name: self test action
uses: ./
14 changes: 13 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,21 @@ runs:
shell: bash
- run: python -m pip freeze --local
shell: bash
- run: |
tf=$(mktemp)
echo "arch=$(uname -p)" >> "$tf"
for program in python ruby go cargo ; do
if command -v $program >/dev/null 2>&1 ; then
echo "$program=$(which $program)" >> "$tf"
fi
done
hash="$(sha256sum < "$tf" | awk '{print $1}')"
echo "dependencyHash=${hash}" >> $GITHUB_OUTPUT
shell: bash
id: computeDependencies
- uses: actions/cache@v4
with:
path: ~/.cache/pre-commit
key: pre-commit-3|${{ env.pythonLocation }}|${{ hashFiles('.pre-commit-config.yaml') }}
key: pre-commit-3|${{ steps.computeDependencies.outputs.dependencyHash }}|${{ hashFiles('.pre-commit-config.yaml') }}
- run: pre-commit run --show-diff-on-failure --color=always ${{ inputs.extra_args }}
shell: bash

0 comments on commit 90eae0c

Please sign in to comment.