Skip to content

Commit

Permalink
add new action for pull request previews
Browse files Browse the repository at this point in the history
  • Loading branch information
orifu committed Sep 25, 2024
1 parent 6bd77b6 commit 646aa90
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions .github/workflows/pull-request-preview.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
on: pull_request
name: pull request preview

jobs:
build:
runs-on: ubuntu-latest

permissions:
pull-requests: write

steps:
- name: checkout
uses: actions/checkout@v4
- name: setup PNPM
uses: pnpm/action-setup@v4
with:
version: latest
- name: setup node
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'pnpm'
- name: install dependencies
run: pnpm i
- name: build page
run: pnpm build

- name: publish to cloudflare pages
id: cloudflare-publish
uses: cloudflare/pages-action@v1
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
projectName: rosebud
directory: dist
branch: pull-${{ github.event.number }}

- name: add link in footer
uses: devindford/Append_PR_Comment@v1.1.3
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
body-template: |
---
[preview this pull request!](${{ steps.cloudflare-publish.outputs.url }})

0 comments on commit 646aa90

Please sign in to comment.