|
18 | 18 | permissions:
|
19 | 19 | checks: write
|
20 | 20 | contents: write # needed to update release
|
21 |
| - pull-requests: write |
| 21 | + pull-requests: write # pr approval and merge |
22 | 22 | steps:
|
23 | 23 | - name: Checkout
|
24 | 24 | uses: actions/checkout@v4
|
@@ -72,13 +72,24 @@ jobs:
|
72 | 72 | # labeled: skip-changelog
|
73 | 73 | # label-operator: NOT
|
74 | 74 |
|
75 |
| - # - name: Auto-approve pull-requests made by approved bots |
76 |
| - # # https://github.com/marketplace/actions/auto-approve |
77 |
| - # if: contains(fromJson('["dependabot[bot]", "pre-commit-ci[bot]"]'), github.actor) |
78 |
| - # uses: hmarr/auto-approve-action@v3 |
| 75 | + # https://docs.github.com/en/code-security/dependabot/working-with-dependabot/automating-dependabot-with-github-actions#approve-a-pull-request |
| 76 | + - name: Dependabot metadata |
| 77 | + if: github.actor == 'dependabot[bot]' |
| 78 | + id: metadata |
| 79 | + uses: dependabot/fetch-metadata@v1 |
| 80 | + with: |
| 81 | + github-token: "${{ secrets.GITHUB_TOKEN }}" |
| 82 | + |
| 83 | + - name: Enable auto-merge for safe bots PRs |
| 84 | + if: contains(fromJson('["dependabot[bot]", "pre-commit-ci[bot]"]'), github.actor) |
| 85 | + run: gh pr merge --auto --merge "$PR_URL" |
| 86 | + env: |
| 87 | + PR_URL: ${{github.event.pull_request.html_url}} |
| 88 | + GH_TOKEN: ${{secrets.GITHUB_TOKEN}} |
79 | 89 |
|
80 |
| - # - name: Enable auto-merge on changes made by approved bots |
81 |
| - # if: contains(fromJson('["dependabot[bot]", "pre-commit-ci[bot]"]'), github.actor) |
82 |
| - # uses: alexwilson/enable-github-automerge-action@main |
83 |
| - # with: |
84 |
| - # github-token: "${{ secrets.GITHUB_TOKEN }}" |
| 90 | + - name: Approve a PR |
| 91 | + if: contains(fromJson('["dependabot[bot]", "pre-commit-ci[bot]"]'), github.actor) |
| 92 | + run: gh pr review --approve "$PR_URL" |
| 93 | + env: |
| 94 | + PR_URL: ${{github.event.pull_request.html_url}} |
| 95 | + GH_TOKEN: ${{secrets.GITHUB_TOKEN}} |
0 commit comments