Skip to content

An open source design system that's fully customizable and agent ready

TypeScript

fix: sync-exports creates a PR instead of pushing to main (#689)

Cindy Zhang5df9e8e000a9
diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml
index eda40fcf8d..7160ceb760 100644
--- a/.github/workflows/deploy.yml
+++ b/.github/workflows/deploy.yml
@@ -29,19 +29,40 @@ jobs:
- name: Sync package.json exports
run: node scripts/sync-exports.js
- - name: Commit and push if changed
+ - name: Create PR if exports changed
+ env:
+ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git diff --quiet packages/core/package.json && exit 0
- git config user.name "github-actions[bot]"
- git config user.email "github-actions[bot]@users.noreply.github.com"
- git add packages/core/package.json
- git commit -m "chore: sync package.json exports [skip ci]"
- git push
+ # Check if there's already an open sync-exports PR
+ EXISTING=$(gh pr list --head "chore/sync-exports" --state open --json number --jq '.[0].number' 2>/dev/null || true)
+ if [ -n "$EXISTING" ]; then
+ echo "Sync-exports PR #$EXISTING already open — updating it"
+ BRANCH=$(gh pr view "$EXISTING" --json headRefName --jq '.headRefName')
+ git config user.name "github-actions[bot]"
+ git config user.email "github-actions[bot]@users.noreply.github.com"
+ git fetch origin "$BRANCH" 2>/dev/null || true
+ git checkout -B "$BRANCH"
+ git add packages/core/package.json
+ git commit -m "chore: sync package.json exports"
+ git push origin "$BRANCH" --force-with-lease
+ else
+ BRANCH="chore/sync-exports"
+ git config user.name "github-actions[bot]"
+ git config user.email "github-actions[bot]@users.noreply.github.com"
+ git checkout -b "$BRANCH"
+ git add packages/core/package.json
+ git commit -m "chore: sync package.json exports"
+ git push origin "$BRANCH"
+ gh pr create \
+ --title "chore: sync package.json exports" \
+ --body "Auto-generated by the sync-exports CI step. Package.json exports were out of sync with the source tree." \
+ --head "$BRANCH" \
+ --base main
+ fi
test:
- needs: sync-exports
- if: always() && !cancelled()
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4