Skip to content

Commit 29195e6

Browse files
committed
ci(gha): auto merge dependabot prs when all CI checks are executed
1 parent ebd05e1 commit 29195e6

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

.github/workflows/pipeline.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ on:
77
branches:
88
- main
99

10+
permissions:
11+
contents: write
12+
pull-requests: write
13+
1014
jobs:
1115
conventional-commit-check:
1216
runs-on: ubuntu-latest
@@ -134,6 +138,27 @@ jobs:
134138
scan-ref: './'
135139
exit-code: 1
136140
trivy-config: ./config/trivy/trivy.yaml
141+
dependabot-pr-auto-merge:
142+
runs-on: ubuntu-latest
143+
needs:
144+
- unit-test
145+
- mutation-test
146+
- dependency-vulnerability-analysis
147+
- sast-snyk
148+
- sast-iac-trivy-hadolint
149+
if: github.event.pull_request.user.login == 'dependabot[bot]' && github.repository == 'abhisheksr01/spring-boot-microservice-best-practices'
150+
steps:
151+
- name: Dependabot metadata
152+
id: metadata
153+
uses: dependabot/fetch-metadata@v2
154+
with:
155+
github-token: ${{ secrets.GITHUB_TOKEN }}
156+
- name: Enable auto-merge for Dependabot PRs
157+
# if: contains(steps.metadata.outputs.dependency-names, 'my-dependency') && steps.metadata.outputs.update-type == 'version-update:semver-patch'
158+
run: gh pr merge --auto --merge "$PR_URL"
159+
env:
160+
PR_URL: ${{github.event.pull_request.html_url}}
161+
GH_TOKEN: ${{secrets.GITHUB_TOKEN}}
137162
docker-build-push:
138163
if: github.ref == 'refs/heads/main'
139164
runs-on: ubuntu-latest

0 commit comments

Comments
 (0)