Skip to content

Commit

Permalink
Set up Dependabot auto-merge & Must pass CI before merging
Browse files Browse the repository at this point in the history
  • Loading branch information
Pil0tXia committed Apr 17, 2024
1 parent c3e6580 commit bb33338
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 4 deletions.
4 changes: 4 additions & 0 deletions .asf.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ github:
main:
required_status_checks:
strict: true
contexts:
- dependency-review
- Build (ubuntu-latest, 8, java)
- Build (ubuntu-latest, 11, java)
required_pull_request_reviews:
dismiss_stale_reviews: true
required_approving_review_count: 0 # Temporary 0 to allow committers to merge themselves PR
Expand Down
3 changes: 1 addition & 2 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,12 @@ updates:
directory: "/"
open-pull-requests-limit: 10
schedule:
interval: "weekly"
interval: "daily" # TODO Temporary daily for testing auto-merge
ignore:
- dependency-name: "*"
update-types: [ "version-update:semver-major" ]
- package-ecosystem: "npm"
directory: "./eventmesh-dashboard-view"
open-pull-requests-limit: 5
schedule:
interval: "monthly"
ignore:
Expand Down
34 changes: 34 additions & 0 deletions .github/workflows/auto-merge-dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Dependabot auto-merge
on: pull_request

permissions:
contents: write
pull-requests: write

jobs:
dependabot:
runs-on: ubuntu-latest
if: github.actor == 'dependabot[bot]'
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Dependabot metadata
id: metadata
uses: dependabot/fetch-metadata@v2
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"
skip-commit-verification: true

- name: Approve a PR
run: gh pr review --approve "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GH_TOKEN: ${{secrets.GITHUB_TOKEN}}

- name: Enable auto-merge for Dependabot PRs
if: steps.metadata.outputs.update-type == 'version-update:semver-patch'
run: gh pr merge --auto --merge "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GH_TOKEN: ${{secrets.GITHUB_TOKEN}}
3 changes: 1 addition & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,5 +61,4 @@ jobs:
cache: maven

- name: Build with Maven
shell: bash
run: ./mvnw -B package --file pom.xml
run: mvn -B package --file pom.xml

0 comments on commit bb33338

Please sign in to comment.