Skip to content

Commit 443acd3

Browse files
snomiaoclaude
andcommitted
[ci] Align Storybook workflows with Playwright improvements
- Add null checks for head_repository to prevent errors with forked PRs - Simplify job status output using direct variable assignment - Remove unnecessary workflow conclusion fetching (use event data directly) - Improve logging for workflow trigger debugging - Only download artifacts when workflow succeeded - Remove duplicate start time calculation - Align error handling with playwright workflows These changes bring the Storybook deployment workflows in line with the improvements made to the Playwright workflows, providing better stability and consistency across CI/CD processes. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 227b973 commit 443acd3

File tree

2 files changed

+17
-45
lines changed

2 files changed

+17
-45
lines changed

.github/workflows/chromatic.yaml

Lines changed: 3 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,6 @@ jobs:
1818
- name: Checkout repository
1919
uses: actions/checkout@v4
2020

21-
- name: Get start time
22-
id: start-time
23-
run: echo "time=$(date -u '+%m/%d/%Y, %I:%M:%S %p')" >> $GITHUB_OUTPUT
24-
2521
- name: Post starting comment
2622
env:
2723
GITHUB_TOKEN: ${{ github.token }}
@@ -31,7 +27,7 @@ jobs:
3127
"${{ github.event.pull_request.number }}" \
3228
"${{ github.head_ref }}" \
3329
"starting" \
34-
"${{ steps.start-time.outputs.time }}"
30+
"$(date -u '+%m/%d/%Y, %I:%M:%S %p')"
3531
3632
# Build Storybook for all PRs (free Cloudflare deployment)
3733
storybook-build:
@@ -78,15 +74,7 @@ jobs:
7874
id: job-status
7975
if: always()
8076
run: |
81-
if [ "${{ job.status }}" = "success" ]; then
82-
echo "conclusion=success" >> $GITHUB_OUTPUT
83-
elif [ "${{ job.status }}" = "cancelled" ]; then
84-
echo "conclusion=cancelled" >> $GITHUB_OUTPUT
85-
elif [ "${{ job.status }}" = "skipped" ]; then
86-
echo "conclusion=skipped" >> $GITHUB_OUTPUT
87-
else
88-
echo "conclusion=failure" >> $GITHUB_OUTPUT
89-
fi
77+
echo "conclusion=${{ job.status }}" >> $GITHUB_OUTPUT
9078
9179
- name: Get workflow URL
9280
id: workflow-url
@@ -158,15 +146,7 @@ jobs:
158146
id: job-status
159147
if: always()
160148
run: |
161-
if [ "${{ job.status }}" = "success" ]; then
162-
echo "conclusion=success" >> $GITHUB_OUTPUT
163-
elif [ "${{ job.status }}" = "cancelled" ]; then
164-
echo "conclusion=cancelled" >> $GITHUB_OUTPUT
165-
elif [ "${{ job.status }}" = "skipped" ]; then
166-
echo "conclusion=skipped" >> $GITHUB_OUTPUT
167-
else
168-
echo "conclusion=failure" >> $GITHUB_OUTPUT
169-
fi
149+
echo "conclusion=${{ job.status }}" >> $GITHUB_OUTPUT
170150
171151
- name: Get workflow URL
172152
id: workflow-url

.github/workflows/pr-storybook-deploy.yaml

Lines changed: 14 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,21 @@ jobs:
1414
if: |
1515
github.repository == 'Comfy-Org/ComfyUI_frontend' &&
1616
github.event.workflow_run.event == 'pull_request' &&
17-
github.event.workflow_run.head_repository.full_name != github.event.workflow_run.repository.full_name &&
18-
(github.event_name == 'workflow_dispatch' || startsWith(github.event.workflow_run.head_branch, 'version-bump-'))
17+
github.event.workflow_run.head_repository != null &&
18+
github.event.workflow_run.repository != null &&
19+
github.event.workflow_run.head_repository.full_name != github.event.workflow_run.repository.full_name
1920
permissions:
2021
pull-requests: write
2122
actions: read
2223
steps:
24+
- name: Log workflow trigger info
25+
run: |
26+
echo "Repository: ${{ github.repository }}"
27+
echo "Event: ${{ github.event.workflow_run.event }}"
28+
echo "Head repo: ${{ github.event.workflow_run.head_repository.full_name || 'null' }}"
29+
echo "Base repo: ${{ github.event.workflow_run.repository.full_name || 'null' }}"
30+
echo "Is forked: ${{ github.event.workflow_run.head_repository.full_name != github.event.workflow_run.repository.full_name }}"
31+
2332
- name: Checkout repository
2433
uses: actions/checkout@v4
2534

@@ -57,39 +66,22 @@ jobs:
5766
"$(date -u '${{ env.DATE_FORMAT }}')"
5867
5968
- name: Download and Deploy Storybook
60-
if: steps.pr.outputs.result != 'null' && github.event.action == 'completed'
69+
if: steps.pr.outputs.result != 'null' && github.event.action == 'completed' && github.event.workflow_run.conclusion == 'success'
6170
uses: actions/download-artifact@v4
6271
with:
6372
github-token: ${{ secrets.GITHUB_TOKEN }}
6473
run-id: ${{ github.event.workflow_run.id }}
6574
name: storybook-static
6675
path: storybook-static
6776

68-
- name: Get workflow conclusion
69-
if: steps.pr.outputs.result != 'null' && github.event.action == 'completed'
70-
id: workflow-status
71-
uses: actions/github-script@v7
72-
with:
73-
script: |
74-
const run = await github.rest.actions.getWorkflowRun({
75-
owner: context.repo.owner,
76-
repo: context.repo.repo,
77-
run_id: context.payload.workflow_run.id,
78-
});
79-
80-
return {
81-
conclusion: run.data.conclusion,
82-
url: run.data.html_url
83-
};
84-
8577
- name: Handle Storybook Completion
8678
if: steps.pr.outputs.result != 'null' && github.event.action == 'completed'
8779
env:
8880
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
8981
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
9082
GITHUB_TOKEN: ${{ github.token }}
91-
WORKFLOW_CONCLUSION: ${{ fromJSON(steps.workflow-status.outputs.result).conclusion }}
92-
WORKFLOW_URL: ${{ fromJSON(steps.workflow-status.outputs.result).url }}
83+
WORKFLOW_CONCLUSION: ${{ github.event.workflow_run.conclusion }}
84+
WORKFLOW_URL: ${{ github.event.workflow_run.html_url }}
9385
run: |
9486
chmod +x scripts/cicd/pr-storybook-deploy-and-comment.sh
9587
./scripts/cicd/pr-storybook-deploy-and-comment.sh \

0 commit comments

Comments
 (0)