Skip to content

Add preview deployments#17

Draft
GrzywN wants to merge 3 commits intomainfrom
@grzywn/pr-preview
Draft

Add preview deployments#17
GrzywN wants to merge 3 commits intomainfrom
@grzywn/pr-preview

Conversation

@GrzywN
Copy link
Copy Markdown
Collaborator

@GrzywN GrzywN commented Apr 7, 2026

Preview Deployments — One-Time Setup

PR previews deploy to https://agentic-engineering.swmansion.com/pr-preview/pr-{number}/ via the preview.yml workflow.
Three settings must be configured in the GitHub repository before this works.

1. GitHub Pages source

Go to Settings → Pages.

Change Source from GitHub Actions to Deploy from a branch, then set:

  • Branch: gh-pages
  • Folder: / (root)

The gh-pages branch is created automatically on the first production deploy after this change.

2. Workflow permissions

Go to Settings → Actions → General → Workflow permissions.

Select Read and write permissions and save.

This allows the deploy and preview workflows to push to the gh-pages branch.

3. BASE_PATH variable (forks only)

When running on a fork, GitHub Pages serves the site under the repository name (e.g. https://username.github.io/agentic-engineering/).
The production and preview builds need to know this prefix.

Go to Settings → Secrets and variables → Actions → Variables → New repository variable:

Name:  BASE_PATH
Value: /agentic-engineering

Do not set this variable on the main repository — leave it unset so the site builds with base: / for the custom domain.

How it works

  • Push to maindeploy.yml builds the site and pushes to gh-pages root, preserving the pr-preview/ directory.
  • PR opened or updated → preview.yml builds with BASE_PATH set to {BASE_PATH}/pr-preview/pr-{number}/ and deploys to gh-pages at that path.
    A sticky bot comment is posted on the PR with the preview URL.
  • PR closed → preview.yml removes pr-preview/pr-{number}/ from gh-pages and updates the comment.

Notes

  • public/.nojekyll disables Jekyll processing on the gh-pages branch, which would otherwise strip the _astro/ directory.
  • GitHub Pages preview deployments are not natively supported by actions/deploy-pages (still in internal alpha as of 2026).
    This setup uses rossjrw/pr-preview-action as a workaround.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 7, 2026

PR Preview Action v1.8.1

QR code for preview link

🚀 View preview at
https://software-mansion.github.io/agentic-engineering/pr-preview/pr-17/

Built to branch gh-pages at 2026-04-07 13:39 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

@GrzywN GrzywN changed the title Add preview flag to the deploy script Add preview deployments Apr 7, 2026
import starlightLlmsTxt from "starlight-llms-txt";

const site = "https://agentic-engineering.swmansion.com/";
const base = process.env.BASE_PATH || "/";
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.

I'm not sure setting default to "/" won't break Astro in some weird way. Wouldn't it be safer to default to undefined or null?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants