Skip to content

Commit a3dbcc3

Browse files
authored
Check out Pull Request HEAD sha
1 parent 19d172c commit a3dbcc3

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

.github/workflows/deploy-site.yml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,15 @@ jobs:
1313
runs-on: ubuntu-latest
1414

1515
steps:
16-
- uses: actions/checkout@v4
16+
- name: Check-out (Production)
17+
uses: actions/checkout@v4
18+
if: github.event_name == 'push'
19+
20+
- name: Check-out (Staging)
21+
uses: actions/checkout@v4
22+
if: github.event_name == 'pull_request_target'
23+
with:
24+
ref: ${{ github.event.pull_request.head.sha }}
1725

1826
- name: Setup Node.js
1927
uses: actions/setup-node@v4
@@ -81,7 +89,7 @@ jobs:
8189
name: Deploy to Staging
8290
needs: [build]
8391
runs-on: ubuntu-latest
84-
if: github.head_ref != 'refs/heads/main'
92+
if: github.event_name == 'pull_request_target'
8593
environment:
8694
name: staging
8795
url: "https://${{ steps.slug.outputs.branch-name-slug }}.blog-staging.jb3.dev/"

0 commit comments

Comments
 (0)