Auto Bump #1
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
| #file: noinspection GithubFunctionSignatureValidation | |
| name: Auto Bump | |
| on: | |
| issue_comment: | |
| types: [created] | |
| # Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages | |
| permissions: | |
| contents: write | |
| id-token: write | |
| pull-requests: write | |
| jobs: | |
| respond: | |
| runs-on: ubuntu-latest | |
| if: (contains( github.event.pull_request.labels.*.name, 'auto-bump') || (contains(github.event.comment.body, '@github-bot') && contains(github.event.comment.body, 'bump'))) | |
| steps: | |
| - name: Add comment to PR | |
| uses: actions/github-script@v7 | |
| with: | |
| script: | | |
| const fs = require('fs'); | |
| const pkg = JSON.parse(fs.readFileSync('./packages/surveyjs-builder/package.json', 'utf8')); | |
| github.rest.issues.createComment({ | |
| issue_number: context.issue.number, | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| body: `Okay boss, ⏳ Bumping version to ${pkg.version}...` | |
| }) | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: ${{ github.event.pull_request.head.ref }} | |
| fetch-depth: 0 | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Setup Node & pnpm | |
| uses: actions/setup-node@v3 | |
| with: | |
| node-version: '23' | |
| - name: Install pnpm | |
| run: npm install -g pnpm | |
| - name: Install dependencies | |
| run: pnpm install | |
| - name: Configure Git | |
| run: | | |
| git config --global user.name 'GitHub Action' | |
| git config --global user.email 'action@github.com' | |
| - name: Bump version | |
| run: | | |
| pnpm run bump | |
| git add package.json | |
| git commit -m "chore: bump version" | |
| git push | |
| - name: Add comment to PR | |
| uses: actions/github-script@v7 | |
| with: | |
| script: | | |
| const fs = require('fs'); | |
| const pkg = JSON.parse(fs.readFileSync('./package.json', 'utf8')); | |
| github.rest.issues.createComment({ | |
| issue_number: context.issue.number, | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| body: `✅ Version bumped to ${pkg.version}` | |
| }) | |