Skip to content

Commit

Permalink
add PR previews
Browse files Browse the repository at this point in the history
  • Loading branch information
rbuckton committed Sep 26, 2024
1 parent 3472859 commit 17b3bd6
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 2 deletions.
1 change: 1 addition & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,5 @@ jobs:
uses: peaceiris/actions-gh-pages@v3
with:
publish_dir: ./build
keep_files: true
github_token: ${{ secrets.GITHUB_TOKEN }}
32 changes: 32 additions & 0 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Publish PR to gh-pages/pr/
on:
pull_request:
branches: [ main ]
jobs:
build:
runs-on: ubuntu-latest
if: ${{ github.event.number }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
- run: npm install
- run: npm run build
- name: Publish HTML to GitHub Pages
if: github.ref == 'refs/heads/main'
uses: peaceiris/actions-gh-pages@v3
with:
publish_dir: ./build
destination_dir: pr/${{ github.event.number }}/
keep_files: true
github_token: ${{ secrets.GITHUB_TOKEN }}
- id: get-preview-url
name: Get preview url
run: echo "::set-output name=preview-url::https://tc39.es/$(basename $GITHUB_REPOSITORY)/pr/${{ github.event.number }}"
shell: bash
- name: Post Preview Comment
uses: phulsechinmay/[email protected]
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COMMENT_IDENTIFIER: tc39_pr_preview_comment
message: |
A preview of this PR can be found at ${{ steps.get-preview-url.outputs.preview-url }}.
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
node_modules
build
node_modules
build

0 comments on commit 17b3bd6

Please sign in to comment.