Update @tscircuit Package #151
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | # ============================================================================= | |
| # Do not change anything in this file. | |
| # This workflow automatically updates @tscircuit packages when triggered by | |
| # the source repository's trigger-dependent-repo-update.yml workflow. | |
| # ============================================================================= | |
| name: Update @tscircuit Package | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| package_names: | |
| description: 'Package names to update (comma-separated, e.g., @tscircuit/core,@tscircuit/props)' | |
| required: true | |
| type: string | |
| default: '<PACKAGE_NAMES>' | |
| env: | |
| PACKAGE_NAMES: ${{ inputs.package_names }} | |
| jobs: | |
| update-package: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| token: ${{ secrets.TSCIRCUIT_BOT_GITHUB_TOKEN }} | |
| - uses: oven-sh/setup-bun@v2 | |
| - name: Update packages | |
| run: | | |
| IFS=',' read -ra PACKAGES <<< "${{ env.PACKAGE_NAMES }}" | |
| for package in "${PACKAGES[@]}"; do | |
| if [[ -n "$package" ]]; then | |
| bun update --latest "$package" | |
| fi | |
| done | |
| - name: Close existing PRs | |
| run: | | |
| gh pr list --repo ${{ github.repository }} --state open --author "tscircuitbot" --json number,title --jq '.[] | select(.title | startswith("chore:")) | .number' | xargs -I{} gh pr close {} --comment "Closing in favor of a new update PR" | |
| env: | |
| GH_TOKEN: ${{ secrets.TSCIRCUIT_BOT_GITHUB_TOKEN }} | |
| - name: Create Pull Request | |
| id: create-pr | |
| uses: peter-evans/create-pull-request@v5 | |
| with: | |
| commit-message: "chore: update packages ${{ env.PACKAGE_NAMES }}" | |
| title: "chore: update packages ${{ env.PACKAGE_NAMES }}" | |
| body: "Automated package update" | |
| branch: update-packages-${{ github.run_number }} | |
| base: main | |
| token: ${{ secrets.TSCIRCUIT_BOT_GITHUB_TOKEN }} | |
| committer: tscircuitbot <[email protected]> | |
| author: tscircuitbot <[email protected]> | |
| - name: Enable auto-merge with CI checks | |
| if: steps.create-pr.outputs.pull-request-number != '' | |
| run: | | |
| gh pr merge ${{ steps.create-pr.outputs.pull-request-number }} --auto --squash --delete-branch | |
| env: | |
| GH_TOKEN: ${{ secrets.TSCIRCUIT_BOT_GITHUB_TOKEN }} |