Skip to content

Commit cb52d01

Browse files
committed
chore(ci): add Storybook frameworks sync workflow and checker script (#436)
* chore(ci): simplify storybook sync workflow script * chore(ci): execute commands with args * chore(ci): feed opencode prompt via markdown * chore(ci): move opencode prompt template to markdown * chore(ci): format sync script * chore(ci): guard github actions env usage
1 parent fafc6b6 commit cb52d01

File tree

3 files changed

+502
-0
lines changed

3 files changed

+502
-0
lines changed
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
name: Storybook Frameworks Sync
2+
3+
on:
4+
schedule:
5+
- cron: "0 8 * * *"
6+
workflow_dispatch:
7+
inputs:
8+
lookback_hours:
9+
description: Lookback window in hours
10+
required: false
11+
default: "36"
12+
13+
jobs:
14+
sync:
15+
runs-on: ubuntu-latest
16+
environment: opencode
17+
permissions:
18+
contents: read
19+
actions: write
20+
env:
21+
STORYBOOK_SYNC_CHECK_LAST_SHA: ${{ vars.STORYBOOK_SYNC_CHECK_LAST_SHA }}
22+
STORYBOOK_SYNC_LOOKBACK_HOURS: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.lookback_hours || '36' }}
23+
steps:
24+
- name: Checkout
25+
uses: actions/checkout@v6
26+
with:
27+
fetch-depth: 1
28+
29+
- name: Install pnpm
30+
run: |
31+
npm install -g corepack@latest --force
32+
corepack enable
33+
34+
- name: Setup Node.js
35+
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
36+
with:
37+
node-version: 20.x
38+
cache: pnpm
39+
40+
- name: Install dependencies
41+
run: pnpm install --frozen-lockfile
42+
43+
- name: Install OpenCode
44+
run: |
45+
curl -fsSL https://opencode.ai/install | bash
46+
echo "$HOME/.opencode/bin" >> "$GITHUB_PATH"
47+
48+
- name: Scan Storybook framework src commits
49+
id: storybook-sync
50+
env:
51+
OPENCODE_API_KEY: ${{ secrets.OPENCODE_API_KEY }}
52+
GITHUB_TOKEN: ${{ github.token }}
53+
OPENCODE_PERMISSION: |
54+
{
55+
"bash": {
56+
"*": "deny"
57+
},
58+
"webfetch": "deny"
59+
}
60+
run: pnpm exec tsx scripts/ci/storybook-frameworks-sync.mts
61+
62+
- name: Update last checked SHA
63+
if: github.event_name == 'schedule' && steps.storybook-sync.outputs.next_head_sha != ''
64+
env:
65+
GH_TOKEN: ${{ github.token }}
66+
run: |
67+
gh variable set STORYBOOK_SYNC_CHECK_LAST_SHA --repo "${{ github.repository }}" --body "${{ steps.storybook-sync.outputs.next_head_sha }}"

0 commit comments

Comments
 (0)