Skip to content

Commit de35b1c

Browse files
committed
HOUSEKEEPING: Commit reference is elusive
1 parent a97e969 commit de35b1c

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

.github/workflows/deploy.yml

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,28 @@ on:
1111
- '*-maintenance'
1212

1313
jobs:
14-
# Job 1: Build the code (no secrets here)
14+
commit_reference:
15+
name: Get Commit Reference
16+
runs-on: ubuntu-latest
17+
outputs:
18+
commit_ref: ${{ steps.set_commit_ref.outputs.commit_ref }}
19+
steps:
20+
- name: Set Commit Reference
21+
id: set_commit_ref
22+
run: |
23+
if [[ "${{ github.event_name }}" == "push" ]]; then
24+
echo "commit_ref=${{ github.sha }}" >> $GITHUB_OUTPUT
25+
else
26+
echo "commit_ref=${{ github.event.pull_request.head.sha }}" >> $GITHUB_OUTPUT
27+
28+
# Build the code (minimal secrets here)
1529
build:
1630
name: Build
31+
needs: commit_reference
1732
uses: ./.github/workflows/build.yml
1833
with:
1934
debug_build: ${{ github.event_name == 'pull_request_target' || github.event_name == 'pull_request' }}
20-
commit_ref: ${{ github.event_name == 'pull_request_target' || github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
35+
commit_ref: ${{ needs.commit_reference.outputs.commit_ref }}
2136
secrets:
2237
RELEASE_KEYSTORE: ${{ secrets.RELEASE_KEYSTORE }}
2338
RELEASE_KEYSTORE_PASSWORD: ${{ secrets.RELEASE_KEYSTORE_PASSWORD }}

0 commit comments

Comments
 (0)