Skip to content

Commit

Permalink
chore: storybook deploy comment 기능 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
ienrum committed Apr 26, 2024
1 parent 87c0330 commit 1f32298
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion .github/workflows/storybook.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
name: 'Publish Storybook to Chromatic'

on: push
on:
push:
branches: main
pull_request:
branches: main

jobs:
publish-storybook-to-chromatic:
Expand All @@ -9,19 +13,37 @@ jobs:
- uses: actions/checkout@v4
with:
fetch-depth: 0

# setup-node의 pnpm 지원을 위한 Action
- uses: pnpm/action-setup@v2
with:
version: 8.15.1

- uses: actions/setup-node@v4
with:
node-version: 18
cache: 'pnpm'
- run: pnpm install

- uses: chromaui/action@v1
with:
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}
token: ${{ secrets.GITHUB_TOKEN }}
exitZeroOnChanges: true
env:
STORYBOOK_API_BASE_URL: ${{ vars.STORYBOOK_API_BASE_URL }}
id: chromatic

- uses: actions/github-script@v7
if: github.event_name == 'pull_request'
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const url = `${{ steps.chromatic.outputs.url }}`;
const message = `🚀 Storybook is deployed! View it here: ${url}`;
const prNumber = context.payload.pull_request.number;
github.rest.issues.createComment({
...context.repo,
issue_number: prNumber,
body: message
});

0 comments on commit 1f32298

Please sign in to comment.