Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 additions & 1 deletion .github/workflows/pr-preview-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ on:
permissions:
actions: read
contents: read
# Write sticky comment
pull-requests: write

env:
CLOUDFLARE_PAGES_PROJECT_NAME: typelevel-website
Expand Down Expand Up @@ -36,11 +38,28 @@ jobs:
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Read PR number
id: pr
run: echo "branch=pr-$(cat pr_number.txt)" >> "$GITHUB_OUTPUT"
run: |
echo "pr=$(cat pr_number.txt)" >> "$GITHUB_OUTPUT"
echo "branch=pr-$(cat pr_number.txt)" >> "$GITHUB_OUTPUT"

- name: Deploy
uses: cloudflare/wrangler-action@v4
id: deploy
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
gitHubToken: ${{ secrets.GITHUB_TOKEN }}
command: pages deploy ./site --project-name=${{ env.CLOUDFLARE_PAGES_PROJECT_NAME }} --branch=${{ steps.pr.outputs.branch }}
- name: Add branch preview info to PR
uses: marocchino/sticky-pull-request-comment@v3
with:
number: ${{ steps.pr.outputs.pr }}
header: preview
message: |
# Branch preview

A preview of the website has been generated with the content of this pull request.

| Name | Result |
| ----------------------- | ------ |
| **Branch Preview URL**: | ${{ steps.deploy.outputs.pages-deployment-alias-url }} |
Comment on lines +63 to +65

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of a table with a single row, can we just put the URL 😅

Loading