|
| 1 | +# ============================================================================= |
| 2 | +# Do not change anything in this file. |
| 3 | +# This workflow automatically updates @tscircuit packages when triggered by |
| 4 | +# the source repository's trigger-dependent-repo-update.yml workflow. |
| 5 | +# ============================================================================= |
| 6 | + |
| 7 | +name: Update @tscircuit Package |
| 8 | + |
| 9 | +on: |
| 10 | + workflow_dispatch: |
| 11 | + inputs: |
| 12 | + package_names: |
| 13 | + description: 'Package names to update (comma-separated, e.g., @tscircuit/core,@tscircuit/props)' |
| 14 | + required: true |
| 15 | + type: string |
| 16 | + default: '<PACKAGE_NAMES>' |
| 17 | + |
| 18 | +env: |
| 19 | + PACKAGE_NAMES: ${{ inputs.package_names }} |
| 20 | + |
| 21 | +jobs: |
| 22 | + update-package: |
| 23 | + runs-on: ubuntu-latest |
| 24 | + |
| 25 | + steps: |
| 26 | + - uses: actions/checkout@v4 |
| 27 | + with: |
| 28 | + token: ${{ secrets.TSCIRCUIT_BOT_GITHUB_TOKEN }} |
| 29 | + - uses: oven-sh/setup-bun@v2 |
| 30 | + - name: Update packages |
| 31 | + run: | |
| 32 | + IFS=',' read -ra PACKAGES <<< "${{ env.PACKAGE_NAMES }}" |
| 33 | + for package in "${PACKAGES[@]}"; do |
| 34 | + if [[ -n "$package" ]]; then |
| 35 | + bun update --latest "$package" |
| 36 | + fi |
| 37 | + done |
| 38 | + - name: Create Pull Request |
| 39 | + id: create-pr |
| 40 | + uses: peter-evans/create-pull-request@v5 |
| 41 | + with: |
| 42 | + commit-message: "chore: update packages ${{ env.PACKAGE_NAMES }}" |
| 43 | + title: "chore: update packages ${{ env.PACKAGE_NAMES }}" |
| 44 | + body: "Automated package update" |
| 45 | + branch: update-packages-${{ github.run_number }} |
| 46 | + base: main |
| 47 | + token: ${{ secrets.TSCIRCUIT_BOT_GITHUB_TOKEN }} |
| 48 | + committer: tscircuitbot <[email protected]> |
| 49 | + author: tscircuitbot <[email protected]> |
| 50 | + - name: Enable auto-merge with CI checks |
| 51 | + if: steps.create-pr.outputs.pull-request-number != '' |
| 52 | + run: | |
| 53 | + gh pr merge ${{ steps.create-pr.outputs.pull-request-number }} --auto --squash --delete-branch |
| 54 | + env: |
| 55 | + GH_TOKEN: ${{ secrets.TSCIRCUIT_BOT_GITHUB_TOKEN }} |
0 commit comments