|
1 | 1 | name: Dependabot auto-merge |
2 | | -on: pull_request |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
3 | 5 |
|
4 | 6 | permissions: |
5 | 7 | contents: write |
6 | 8 | pull-requests: write |
7 | 9 |
|
8 | 10 | jobs: |
9 | | - dependabot: |
10 | | - runs-on: ubuntu-latest |
| 11 | + auto-merge: |
| 12 | + name: Auto-merge patch |
11 | 13 | if: github.actor == 'dependabot[bot]' |
| 14 | + runs-on: ubuntu-24.04 |
12 | 15 | steps: |
13 | | - - name: Dependabot metadata |
| 16 | + - uses: dependabot/fetch-metadata@v2 |
14 | 17 | id: metadata |
15 | | - uses: dependabot/fetch-metadata@v2 |
| 18 | + |
| 19 | + - name: Generate app token |
| 20 | + if: steps.metadata.outputs.update-type == 'version-update:semver-patch' |
| 21 | + id: app-token |
| 22 | + uses: actions/create-github-app-token@v2 |
16 | 23 | with: |
17 | | - github-token: "${{ secrets.GITHUB_TOKEN }}" |
| 24 | + app-id: ${{ secrets.APP_ID }} |
| 25 | + private-key: ${{ secrets.APP_PRIVATE_KEY }} |
| 26 | + |
| 27 | + - name: Approve PR |
| 28 | + if: steps.metadata.outputs.update-type == 'version-update:semver-patch' |
| 29 | + run: gh pr review "$PR" --approve |
| 30 | + env: |
| 31 | + PR: ${{ github.event.pull_request.html_url }} |
| 32 | + GH_TOKEN: ${{ steps.app-token.outputs.token }} |
18 | 33 |
|
19 | | - - name: Auto-merge minor and patch updates |
20 | | - if: steps.metadata.outputs.update-type == 'version-update:semver-patch' || steps.metadata.outputs.update-type == 'version-update:semver-minor' |
21 | | - run: gh pr merge --auto --squash "$PR_URL" |
| 34 | + - name: Enable auto-merge |
| 35 | + if: steps.metadata.outputs.update-type == 'version-update:semver-patch' |
| 36 | + run: gh pr merge "$PR" --auto --squash |
22 | 37 | env: |
23 | | - PR_URL: ${{ github.event.pull_request.html_url }} |
24 | | - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 38 | + PR: ${{ github.event.pull_request.html_url }} |
| 39 | + GH_TOKEN: ${{ github.token }} |
0 commit comments