Skip to main content

Pull request previews for GitHub

Integrating PushPreview with GitHub empowers efficient collaboration and code quality through automated preview generation directly within your workflow. This documentation details the installation, authentication, and configuration specifics of PushPreview integration with GitHub.


Enable pull request previews on GitHub with PushPreview by following the Quickstart.

This step-by-step guide explains how to integrate automated preview generation into your GitHub workflow, streamlining review processes for web projects and applications


Previews generated through PushPreview are public by default. However, for added security or confidentiality, PushPreview offers private previews. For more information, see Private previews.

When accessing a private preview, PushPreview prompts for a GitHub login to ensure secure access:

GitHub enable

Only users with permission to see the repository can access the preview.

PushPreview uses OAuth 2.0 authentication to maintain a secure connection with GitHub.

GitHub Action

The PushLabsHQ/pushpreview-action facilitates the connection between GitHub and PushPreview, integrating it into your GitHub workflow.

Below is an example of how to use the push-preview-action in a workflow:

 name: PushPreview

- labeled

runs-on: ubuntu-latest
if: == 'preview'
- uses: actions/checkout@v3
- name: Comment
run: |
gh pr comment ${{ github.event.pull_request.number }} --repo ${{ github.repository }} --body "⚙️ Hang tight! PushPreview is currently building your preview. We'll share the URL as soon as it's ready."
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- uses: actions/setup-node@v3
node-version: 18

- name: Set BASE_URL
run: echo "BASE_URL=/github/${{ github.repository }}/${{ github.event.number }}/" >> $GITHUB_ENV

# Replace with your docs build commands
- name: Build site
run: |
cd docs
yarn install --frozen-lockfile
yarn build

- name: Generate preview
uses: PushLabsHQ/pushpreview-action@1.0.6
# Replace with your docs output directory
source-directory: ./docs/build
github-token: ${{ secrets.GITHUB_TOKEN }}
pushpreview-token: ${{ secrets.PUSHPREVIEW_TOKEN }}

For more information on customizing the workflow to your build process, refer to the Installation section for CMS-specific guides.