chore: changeset config to use main instead of dev #2
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
| name: Version PR | |
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: | |
| - main | |
| paths: | |
| - '.changeset/**' | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| jobs: | |
| version-pr: | |
| name: Create Version PR | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout Repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| token: ${{ secrets.PAT_TOKEN }} | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v4 | |
| with: | |
| version: 9.0.0 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| cache: 'pnpm' | |
| - name: Install Dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Check for Changesets | |
| id: check-changesets | |
| run: | | |
| if [ -n "$(ls -A .changeset/*.md 2>/dev/null | grep -v README)" ]; then | |
| echo "has-changesets=true" >> $GITHUB_OUTPUT | |
| else | |
| echo "has-changesets=false" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Create Version Branch | |
| if: steps.check-changesets.outputs.has-changesets == 'true' | |
| run: | | |
| git config --local user.email "github-actions[bot]@users.noreply.github.com" | |
| git config --local user.name "github-actions[bot]" | |
| git checkout -b chore/version-packages-$(date +%s) | |
| pnpm version | |
| git add . | |
| git commit -m "chore: version packages" || echo "No changes to commit" | |
| git push origin HEAD | |
| - name: Create Pull Request | |
| if: steps.check-changesets.outputs.has-changesets == 'true' | |
| uses: peter-evans/create-pull-request@v6 | |
| with: | |
| token: ${{ secrets.PAT_TOKEN }} | |
| branch: chore/version-packages-${{ github.run_number }} | |
| base: main | |
| title: 'chore: version packages' | |
| body: | | |
| This PR was automatically generated by the Version PR workflow. | |
| It bumps package versions and updates changelogs based on changesets. | |
| **Please review the changes before merging!** | |
| Once merged to `main`, the release workflow will automatically publish the packages. | |
| labels: | | |
| automated | |
| release | |