Skip to content

fix #30 - feat: Add GitHub Action to publish Storybook preview for every PR via Netlify#58

Open
fantonangeli wants to merge 12 commits intoserverlessworkflow:mainfrom
fantonangeli:issue-30-feat-Add-GitHub-Action-to-publish-Storybook-preview-for-every-PR-via-netlify
Open

fix #30 - feat: Add GitHub Action to publish Storybook preview for every PR via Netlify#58
fantonangeli wants to merge 12 commits intoserverlessworkflow:mainfrom
fantonangeli:issue-30-feat-Add-GitHub-Action-to-publish-Storybook-preview-for-every-PR-via-netlify

Conversation

@fantonangeli
Copy link
Copy Markdown
Member

@fantonangeli fantonangeli commented Apr 7, 2026

Closes #30

Description

Add a GitHub Actions workflow that publishes a live Storybook preview for every pull request using Netlify.

The goal is that each PR gets a preview URL where reviewers and contributors can open and interact with the Storybook build for that branch, without needing to run the project locally.

Motivation

Reviewing UI and UX changes is much easier when a live preview is available directly from the PR.

This would help us:

  • let reviewers test Storybook examples from any PR
  • make component and editor UX changes easier to validate
  • reduce the need for local checkout just to review visual changes
  • give contributors a shared preview environment during implementation

Proposed Implementation

No response

Definition of Done

  • Implementation: Fully implemented according to the Serverless Workflow spec.
  • Unit Tests: Comprehensive unit tests are included and passing.
  • Integration Tests: Verified within the monorepo and target environments (Web/VS Code).
  • Documentation: Updated README.md, ADRs, or official docs.
  • Performance: No significant regression in editor responsiveness.
  • Accessibility: UI changes comply with accessibility standards.

Preview PR from my fork:

I created 2 test PR against my fork to show what is the final result of this configuration:

Signed-off-by: fantonangeli <fabrizio.antonangeli@gmail.com>
Signed-off-by: fantonangeli <fabrizio.antonangeli@gmail.com>
Signed-off-by: fantonangeli <fabrizio.antonangeli@gmail.com>
Signed-off-by: fantonangeli <fabrizio.antonangeli@gmail.com>
Signed-off-by: fantonangeli <fabrizio.antonangeli@gmail.com>
…Hub-Action-to-publish-Storybook-preview-for-every-PR-via-netlify

Signed-off-by: fantonangeli <fabrizio.antonangeli@gmail.com>
Signed-off-by: fantonangeli <fabrizio.antonangeli@gmail.com>
Signed-off-by: fantonangeli <fabrizio.antonangeli@gmail.com>
Signed-off-by: fantonangeli <fabrizio.antonangeli@gmail.com>
Copilot AI review requested due to automatic review settings April 7, 2026 16:53
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR aims to provide per-PR Storybook previews, and currently introduces a Netlify-based build/publish configuration for the diagram editor’s Storybook along with a small tooling-doc update.

Changes:

  • Update root README prerequisites to reference Node.js 24.
  • Add netlify.toml to build and publish @serverlessworkflow/diagram-editor Storybook output (and skip builds when the package isn’t affected vs origin/main).

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

File Description
README.md Updates local prerequisites (Node version).
netlify.toml Adds Netlify configuration to build/publish Storybook and conditionally skip builds based on package changes.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@fantonangeli fantonangeli changed the title fix #30 - feat: Add GitHub Action to publish Storybook preview for every PR via Surge fix #30 - feat: Add GitHub Action to publish Storybook preview for every PR via Netlify Apr 7, 2026
@fantonangeli fantonangeli marked this pull request as draft April 7, 2026 17:04
Signed-off-by: fantonangeli <fabrizio.antonangeli@gmail.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@fantonangeli fantonangeli added the enhancement New feature or request label Apr 8, 2026
Signed-off-by: fantonangeli <fabrizio.antonangeli@gmail.com>
@fantonangeli fantonangeli marked this pull request as ready for review April 8, 2026 08:24
Copilot AI review requested due to automatic review settings April 8, 2026 08:24
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +31 to +33
git fetch --no-tags --depth=1 origin main:refs/remotes/origin/main
npm i -g "pnpm@$PNPM_VERSION"
! pnpm -F '...[origin/main]' -rc exec 'echo "$PNPM_PACKAGE_NAME"' | grep -Fqx "$PREVIEW_PACKAGE_NAME"
Copy link

Copilot AI Apr 8, 2026

Choose a reason for hiding this comment

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

The ignore check hard-codes main (git fetch ... origin main and ...[origin/main]). This will behave incorrectly if the default branch changes or if a PR targets a non-main base branch. Consider deriving the base ref dynamically (e.g., from Netlify/GitHub-provided PR base branch env) so preview builds are skipped/run against the actual PR base.

Suggested change
git fetch --no-tags --depth=1 origin main:refs/remotes/origin/main
npm i -g "pnpm@$PNPM_VERSION"
! pnpm -F '...[origin/main]' -rc exec 'echo "$PNPM_PACKAGE_NAME"' | grep -Fqx "$PREVIEW_PACKAGE_NAME"
BASE_REF="${GITHUB_BASE_REF:-$(git symbolic-ref --quiet --short refs/remotes/origin/HEAD | sed 's#^origin/##')}"
git fetch --no-tags --depth=1 origin "$BASE_REF:refs/remotes/origin/$BASE_REF"
npm i -g "pnpm@$PNPM_VERSION"
! pnpm -F "...[origin/$BASE_REF]" -rc exec 'echo "$PNPM_PACKAGE_NAME"' | grep -Fqx "$PREVIEW_PACKAGE_NAME"

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I don't want to introduce too much logic, deriving the branch ref and risking to have bugs with:

BASE_REF="${GITHUB_BASE_REF:-$(git symbolic-ref --quiet --short refs/remotes/origin/HEAD | sed 's#^origin/##')}"

Signed-off-by: fantonangeli <fabrizio.antonangeli@gmail.com>
@ricardozanini
Copy link
Copy Markdown
Member

Amazing!!

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

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: Add GitHub Action to publish Storybook preview for every PR via Surge

5 participants