Skip to content
Merged
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-storybook-deploy-manual.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
name: Storybook PR Preview (manual)

on:
workflow_dispatch:
inputs:
pr_number:
description: "Pull Request number"
required: true
type: string
action:
description: "What to do with the preview"
required: true
type: choice
options:
- deploy
- remove
default: deploy

permissions:
contents: write
pull-requests: write

concurrency:
group: storybook-preview-${{ inputs.pr_number }}
cancel-in-progress: true

env:
SOURCE_DIR: ./apps/react-storybook/storybook-static

jobs:
preview:
name: ${{ inputs.action }} Storybook preview for PR
runs-on: ubuntu-latest
timeout-minutes: 30
environment: github-pages

steps:
- name: Checkout PR head commit
if: inputs.action == 'deploy'
uses: actions/checkout@v4
with:
ref: refs/pull/${{ inputs.pr_number }}/head
fetch-depth: 1

- name: Use Node.js
if: inputs.action == 'deploy'
uses: actions/setup-node@v4
with:
node-version: "20"

- name: Setup pnpm
if: inputs.action == 'deploy'
uses: pnpm/action-setup@v4
with:
run_install: false

- name: Get pnpm store directory
if: inputs.action == 'deploy'
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV

- name: Setup pnpm + nx cache
if: inputs.action == 'deploy'
uses: actions/cache@v4
with:
path: |
${{ env.STORE_PATH }}
.nx/cache
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store

- name: Install dependencies
if: inputs.action == 'deploy'
run: pnpm install --frozen-lockfile

- name: Build Storybook preview (static)
if: inputs.action == 'deploy'
run: |
pnpx nx build devextreme-react-storybook

Copy link

Copilot AI Feb 2, 2026

Choose a reason for hiding this comment

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

When the action is 'remove', all setup steps are skipped (lines 38-81), but the deployment step at line 83 still runs. The pr-preview-action needs to checkout the gh-pages branch and remove the preview directory when action is 'remove'.

However, without the checkout step running (line 38 has if: inputs.action == 'deploy'), the action may not have access to the repository. Consider adding a separate checkout step for the 'remove' action that checks out the default branch or gh-pages branch, or removing the condition from line 38 so checkout always happens.

Suggested change
- name: Checkout gh-pages for removal
if: inputs.action == 'remove'
uses: actions/checkout@v4
with:
ref: gh-pages
fetch-depth: 1

Copilot uses AI. Check for mistakes.
- name: Deploy/remove PR preview
uses: rossjrw/pr-preview-action@8ff09e486b4c23709012eedd3b42e9f0b95dd0c5 # v1
with:
action: ${{ inputs.action }}
pr-number: ${{ inputs.pr_number }}
source-dir: ${{ env.SOURCE_DIR }}
preview-branch: gh-pages
umbrella-dir: preview
comment: false
token: ${{ secrets.GITHUB_TOKEN }}
Loading