Skip to content

Commit

Permalink
Add auto-merge on dependabot PR
Browse files Browse the repository at this point in the history
  • Loading branch information
charphi committed Sep 25, 2023
1 parent 75f35db commit 67cc3f1
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion .github/workflows/java-maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on: [ push, pull_request ]

jobs:
build-and-test-job:
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name
if: github.event_name == 'pull_request' || startsWith(github.ref, 'refs/heads/develop') || startsWith(github.ref, 'refs/tags/v')
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -36,6 +36,23 @@ jobs:
with:
run: mvn -U -B -ntp package

auto-merge-job:
needs: build-and-test-job
if: startsWith(github.repository, 'jdemetra/') && github.event_name == 'pull_request' && github.actor == 'dependabot[bot]'
permissions:
contents: write
pull-requests: write

name: Auto-merge on dependabot PR
runs-on: ubuntu-latest

steps:
- name: Merge PR
run: gh pr merge --auto --rebase "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}

snapshot-job:
needs: build-and-test-job
if: startsWith(github.repository, 'jdemetra/') && startsWith(github.ref, 'refs/heads/develop')
Expand Down

0 comments on commit 67cc3f1

Please sign in to comment.