Skip to content
Draft
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
92 changes: 92 additions & 0 deletions .github/workflows/pr-preview.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
name: PR Preview

on:
pull_request:
types: [opened, reopened, synchronize, closed]
paths:
- "site/**"
- "extensions/**"
- "text/**"
- ".github/workflows/pr-preview.yml"
Copy link
Copy Markdown
Member Author

@benbellick benbellick Apr 23, 2026

Choose a reason for hiding this comment

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

This is there so that we could test it on changes to this file.


concurrency:
group: preview-${{ github.ref }}
cancel-in-progress: true

permissions:
contents: read
pull-requests: write

jobs:
deploy:
name: Deploy PR Preview
runs-on: ubuntu-latest
if: >-
github.repository == 'substrait-io/substrait' &&
github.event.pull_request.head.repo.full_name == github.repository &&
github.event.action != 'closed'
steps:
- uses: actions/checkout@v6
- uses: prefix-dev/setup-pixi@v0.9.5
with:
pixi-version: v0.66.0
cache: true
- name: Copy schema file for website
run: |
mkdir -p ./site/docs/schemas
cp ./text/simple_extensions_schema.yaml ./site/docs/schemas/simple_extensions
- name: Rewrite site_url for preview
env:
PR: ${{ github.event.pull_request.number }}
run: |
sed -i "s|^site_url:.*|site_url: \"https://substrait.io/preview/${PR}/\"|" site/mkdocs.yml
- name: Generate Static Site
run: pixi run mkdocs build
- name: Deploy preview
uses: peaceiris/actions-gh-pages@v4
with:
external_repository: substrait-io/substrait.io
publish_branch: main
deploy_key: ${{ secrets.SUBSTRAIT_SITE_DEPLOY_KEY }}
publish_dir: ./site/site
destination_dir: preview/${{ github.event.pull_request.number }}
keep_files: true
commit_message: "Deploy preview for PR #${{ github.event.pull_request.number }}"
- name: Comment preview URL on PR
uses: marocchino/sticky-pull-request-comment@v2
with:
header: pr-preview
message: |
Preview: https://substrait.io/preview/${{ github.event.pull_request.number }}/
_Updated for ${{ github.event.pull_request.head.sha }}_

cleanup:
name: Cleanup PR Preview
runs-on: ubuntu-latest
if: >-
github.repository == 'substrait-io/substrait' &&
github.event.pull_request.head.repo.full_name == github.repository &&
github.event.action == 'closed'
steps:
- uses: actions/checkout@v6
with:
repository: substrait-io/substrait.io
ssh-key: ${{ secrets.SUBSTRAIT_SITE_DEPLOY_KEY }}
path: site-repo
- name: Remove preview directory
working-directory: site-repo
env:
PR: ${{ github.event.pull_request.number }}
run: |
if [ -d "preview/$PR" ]; then
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
Copy link
Copy Markdown
Member Author

@benbellick benbellick Apr 28, 2026

Choose a reason for hiding this comment

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

git rm -rf "preview/$PR"
git commit -m "Remove preview for PR #$PR"
git push
fi
- name: Delete preview comment
uses: marocchino/sticky-pull-request-comment@v2
with:
header: pr-preview
delete: true
Loading