Skip to content

Commit 227b7f6

Browse files
fix: correctly retrieve commit SHA in PRs (#10)
1 parent f59e527 commit 227b7f6

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

action.yml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,17 @@ runs:
9393
npm install -g pnpm
9494
npm install -g yarn
9595
96+
- name: Set commit SHA
97+
# Required because of isolation issues in PRs
98+
id: set-sha
99+
shell: bash
100+
run: |
101+
if [[ "$GITHUB_EVENT_NAME" == "pull_request" ]]; then
102+
echo "commit_sha=$(jq -r .pull_request.head.sha $GITHUB_EVENT_PATH)" >> $GITHUB_OUTPUT
103+
else
104+
echo "commit_sha=$GITHUB_SHA" >> $GITHUB_OUTPUT
105+
fi
106+
96107
- name: Restore cache
97108
uses: actions/cache/restore@v4
98109
id: restore-cache
@@ -238,7 +249,7 @@ runs:
238249
if: always()
239250
with:
240251
path: tool/cache
241-
key: dirty-waters-cache-${{ runner.os }}-${{ inputs.project_repo }}-${{ github.sha }}
252+
key: dirty-waters-cache-${{ runner.os }}-${{ inputs.project_repo }}-${{ steps.set-sha.outputs.commit_sha }}
242253

243254
- name: Break CI if analyses fail
244255
run: exit $(( steps.analysis.outcome == 'failure' ))

0 commit comments

Comments
 (0)