Skip to content

Commit 155df31

Browse files
authored
chore(ci): use publish previews for pull request target (npm#171)
Also always checkout main for everything else
1 parent b2d4eb3 commit 155df31

File tree

2 files changed

+19
-54
lines changed

2 files changed

+19
-54
lines changed

.github/workflows/publish.yml

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ on:
44
push:
55
branches:
66
- main
7+
pull_request_target:
78
workflow_dispatch:
89
workflow_call:
910

@@ -12,10 +13,21 @@ jobs:
1213
permissions:
1314
contents: read
1415
runs-on: ubuntu-latest
16+
1517
steps:
16-
# Check out the content (source branch)
17-
- name: Check out source
18+
- name: Checkout PR
19+
if: ${{ github.event_name == 'pull_request_target' }}
20+
uses: actions/checkout@v3
21+
with:
22+
ref: ${{ github.event.pull_request.head.ref }}
23+
repository: ${{ github.event.pull_request.head.repo.full_name }}
24+
25+
- name: Checkout
26+
if: ${{ github.event_name != 'pull_request_target' }}
1827
uses: actions/checkout@v3
28+
with:
29+
ref: main
30+
1931
- name: Setup Pages
2032
uses: actions/configure-pages@v1
2133
- name: Use Node.js
@@ -46,6 +58,8 @@ jobs:
4658
runs-on: ubuntu-latest
4759
needs: build-and-upload
4860
steps:
49-
- name: Deploy to GitHub Pages
50-
id: deployment
51-
uses: actions/deploy-pages@v1
61+
- name: Deploy to GitHub Pages
62+
id: deployment
63+
uses: paper-spa/deploy-pages@main
64+
with:
65+
preview: ${{ github.event_name == 'pull_request_target' }}

.github/workflows/stage-pull-request.yml

Lines changed: 0 additions & 49 deletions
This file was deleted.

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy