Skip to content

Commit 17b3bd6

Browse files
committed
add PR previews
1 parent 3472859 commit 17b3bd6

File tree

3 files changed

+35
-2
lines changed

3 files changed

+35
-2
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,5 @@ jobs:
1818
uses: peaceiris/actions-gh-pages@v3
1919
with:
2020
publish_dir: ./build
21+
keep_files: true
2122
github_token: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/pr.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Publish PR to gh-pages/pr/
2+
on:
3+
pull_request:
4+
branches: [ main ]
5+
jobs:
6+
build:
7+
runs-on: ubuntu-latest
8+
if: ${{ github.event.number }}
9+
steps:
10+
- uses: actions/checkout@v4
11+
- uses: actions/setup-node@v4
12+
- run: npm install
13+
- run: npm run build
14+
- name: Publish HTML to GitHub Pages
15+
if: github.ref == 'refs/heads/main'
16+
uses: peaceiris/actions-gh-pages@v3
17+
with:
18+
publish_dir: ./build
19+
destination_dir: pr/${{ github.event.number }}/
20+
keep_files: true
21+
github_token: ${{ secrets.GITHUB_TOKEN }}
22+
- id: get-preview-url
23+
name: Get preview url
24+
run: echo "::set-output name=preview-url::https://tc39.es/$(basename $GITHUB_REPOSITORY)/pr/${{ github.event.number }}"
25+
shell: bash
26+
- name: Post Preview Comment
27+
uses: phulsechinmay/[email protected]
28+
with:
29+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
30+
COMMENT_IDENTIFIER: tc39_pr_preview_comment
31+
message: |
32+
A preview of this PR can be found at ${{ steps.get-preview-url.outputs.preview-url }}.

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
node_modules
2-
build
1+
node_modules
2+
build

0 commit comments

Comments
 (0)