Skip to content

Commit 580aeae

Browse files
committed
use the determined PR_SHA before checking out code
1 parent 17761eb commit 580aeae

File tree

1 file changed

+6
-15
lines changed

1 file changed

+6
-15
lines changed

.github/workflows/deploy-to-control-plane-review-app.yml

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -41,21 +41,6 @@ jobs:
4141
contains(github.event.comment.body, '/deploy-review-app'))
4242
runs-on: ubuntu-latest
4343
steps:
44-
# Initial checkout only for pull_request and push events
45-
- name: Checkout code
46-
if: github.event_name == 'pull_request' || github.event_name == 'push'
47-
uses: actions/checkout@v4
48-
with:
49-
fetch-depth: 0
50-
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.ref }}
51-
52-
# Basic checkout for other events (workflow_dispatch, issue_comment)
53-
# We'll do proper checkout after getting PR info
54-
- name: Initial checkout
55-
if: github.event_name == 'workflow_dispatch' || github.event_name == 'issue_comment'
56-
uses: actions/checkout@v4
57-
with:
58-
fetch-depth: 0
5944

6045
- name: Validate Required Secrets and Variables
6146
shell: bash
@@ -145,6 +130,12 @@ jobs:
145130
echo "APP_NAME=${{ vars.REVIEW_APP_PREFIX }}-$PR_NUMBER" >> $GITHUB_ENV
146131
echo "PR_REF=$(echo $PR_DATA | jq -r .headRefName)" >> $GITHUB_OUTPUT
147132
echo "PR_SHA=$(echo $PR_DATA | jq -r .headRefOid)" >> $GITHUB_ENV
133+
134+
- name: Checkout code
135+
uses: actions/checkout@v4
136+
with:
137+
fetch-depth: 0
138+
ref: ${{ env.PR_SHA }}
148139

149140
- name: Setup Environment
150141
uses: ./.github/actions/setup-environment

0 commit comments

Comments
 (0)