|
| 1 | +#file: noinspection GithubFunctionSignatureValidation |
| 2 | +name: Auto Bump |
| 3 | +on: |
| 4 | + issue_comment: |
| 5 | + types: [created] |
| 6 | + |
| 7 | +# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages |
| 8 | +permissions: |
| 9 | + contents: write |
| 10 | + id-token: write |
| 11 | + pull-requests: write |
| 12 | + |
| 13 | +jobs: |
| 14 | + respond: |
| 15 | + runs-on: ubuntu-latest |
| 16 | + if: (contains( github.event.pull_request.labels.*.name, 'auto-bump') || (contains(github.event.comment.body, '@github-bot') && contains(github.event.comment.body, 'bump'))) |
| 17 | + steps: |
| 18 | + |
| 19 | + - name: Add comment to PR |
| 20 | + uses: actions/github-script@v7 |
| 21 | + with: |
| 22 | + script: | |
| 23 | + const fs = require('fs'); |
| 24 | + const pkg = JSON.parse(fs.readFileSync('./packages/surveyjs-builder/package.json', 'utf8')); |
| 25 | + github.rest.issues.createComment({ |
| 26 | + issue_number: context.issue.number, |
| 27 | + owner: context.repo.owner, |
| 28 | + repo: context.repo.repo, |
| 29 | + body: `Okay boss, ⏳ Bumping version to ${pkg.version}...` |
| 30 | + }) |
| 31 | +
|
| 32 | + - name: Checkout |
| 33 | + uses: actions/checkout@v4 |
| 34 | + with: |
| 35 | + ref: ${{ github.event.pull_request.head.ref }} |
| 36 | + fetch-depth: 0 |
| 37 | + token: ${{ secrets.GITHUB_TOKEN }} |
| 38 | + |
| 39 | + |
| 40 | + - name: Setup Node & pnpm |
| 41 | + uses: actions/setup-node@v3 |
| 42 | + with: |
| 43 | + node-version: '23' |
| 44 | + |
| 45 | + - name: Install pnpm |
| 46 | + run: npm install -g pnpm |
| 47 | + |
| 48 | + - name: Install dependencies |
| 49 | + run: pnpm install |
| 50 | + |
| 51 | + - name: Configure Git |
| 52 | + run: | |
| 53 | + git config --global user.name 'GitHub Action' |
| 54 | + git config --global user.email '[email protected]' |
| 55 | +
|
| 56 | + - name: Bump version |
| 57 | + run: | |
| 58 | + pnpm run bump |
| 59 | + git add package.json |
| 60 | + git commit -m "chore: bump version" |
| 61 | + git push |
| 62 | +
|
| 63 | + - name: Add comment to PR |
| 64 | + uses: actions/github-script@v7 |
| 65 | + with: |
| 66 | + script: | |
| 67 | + const fs = require('fs'); |
| 68 | + const pkg = JSON.parse(fs.readFileSync('./package.json', 'utf8')); |
| 69 | + github.rest.issues.createComment({ |
| 70 | + issue_number: context.issue.number, |
| 71 | + owner: context.repo.owner, |
| 72 | + repo: context.repo.repo, |
| 73 | + body: `✅ Version bumped to ${pkg.version}` |
| 74 | + }) |
| 75 | + |
0 commit comments