Skip to content

Added Status to Text Component #12824

Added Status to Text Component

Added Status to Text Component #12824

name: Storybook Preview Publish
on:
workflow_dispatch:
pull_request:
jobs:
deploy:
runs-on: ubuntu-latest
permissions:
contents: read
deployments: write
pull-requests: write
name: Deploy to Cloudflare Pages
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: "20"
cache: "yarn"
- name: Install dependencies
run: yarn
- name: Run build
run: yarn build-storybook
env:
NODE_OPTIONS: "--max_old_space_size=6144"
- name: Publish
uses: cloudflare/pages-action@v1
id: publish
with:
apiToken: ${{ secrets.CLOUDFLARE_SALT_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_SALT_ACCOUNT_ID }}
projectName: "saltdesignsystem-storybook"
directory: ./storybook-static
gitHubToken: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ github.head_ref || github.ref_name }}
- name: Preview URL
uses: actions/github-script@v6
with:
script: |
if (context.eventName == 'pull_request') {
const previewUrl = "${{ steps.publish.outputs.url }}";
const commentText = `Storybook Preview Link `;
const {data: comments} = await github.rest.issues.listComments({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.payload.number,
});
const oldPreviewUrlComment = comments.find(comment => comment.body.includes(commentText));
if (!oldPreviewUrlComment) {
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: `${commentText} ${previewUrl}`
});
} else {
github.rest.issues.updateComment({
comment_id: oldPreviewUrlComment.id,
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: `${commentText} ${previewUrl}`
});
};
}