Skip to content

Commit 1235ed0

Browse files
naugturMrtenz
andauthored
fix: if we want to allow pre-existing git checkout state, we must read its commit hash (#15)
The action allows updates to the local git clone prior to it running, but it ignores them. --------- Co-authored-by: Maarten Zuidhoorn <[email protected]>
1 parent e9fd678 commit 1235ed0

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

action.yml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,13 @@ runs:
6161
fetch-depth: ${{ inputs.fetch-depth }}
6262
ref: ${{ inputs.ref }}
6363

64+
# Get the commit hash of the checked out commit regardless of whether it
65+
# was checked out in the previous step or existed before.
66+
- name: Get commit hash
67+
id: get-commit-hash
68+
run: echo "actual-commit-hash=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT"
69+
shell: bash
70+
6471
- run: corepack enable
6572
shell: bash
6673

@@ -72,7 +79,7 @@ runs:
7279
uses: actions/cache/restore@v4
7380
with:
7481
path: ./node_modules
75-
key: node-modules-${{ github.sha }}
82+
key: node-modules-${{ steps.get-commit-hash.outputs.actual-commit-hash }}
7683

7784
- name: Set up Node.js
7885
uses: actions/setup-node@v4
@@ -121,4 +128,4 @@ runs:
121128
uses: actions/cache/save@v4
122129
with:
123130
path: ./node_modules
124-
key: node-modules-${{ github.sha }}
131+
key: node-modules-${{ steps.get-commit-hash.outputs.actual-commit-hash }}

0 commit comments

Comments
 (0)