Skip to content

Commit fbdc207

Browse files
committed
add auto-merge for dependabot PRs
1 parent f069d6f commit fbdc207

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
on:
2+
pull_request:
3+
branches: [ dependabot/* ]
4+
5+
name: Dependabot updates
6+
run-name: Dependabot
7+
8+
permissions:
9+
contents: read
10+
11+
jobs:
12+
dependabot:
13+
runs-on: ubuntu-latest
14+
if: ${{ github.event.pull_request.user.login == 'dependabot[bot]' && github.repository == 'aws-powertools/powertools-lambda-java' }}
15+
permissions:
16+
pull-requests: read
17+
steps:
18+
- id: dependabot-metadata
19+
name: Fetch Dependabot metadata
20+
uses: dependabot/fetch-metadata@d7267f607e9d3fb96fc2fbe83e0af444713e90b7 # v2.3.0
21+
- name: Fail workflow
22+
if: ${{ steps.dependabot-metadata.outputs.update-type == 'version-update:semver-major' }}
23+
run: |
24+
echo "::error::Major version upgrades are not wanted"
25+
- name: Approve PR
26+
env:
27+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
28+
run: |
29+
gh pr review "${{ github.event.pull_request.html_url }}" --approve --body '🤖 Approved by another robot.'
30+
- name: Enable auto-merge on PR
31+
run: gh pr merge --auto --squash "${{ github.event.pull_request.html_url }}"
32+
env:
33+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)