Skip to content

Commit

Permalink
[ISSUE #122] Enable auto-merge workflow of Dependabot (#123)
Browse files Browse the repository at this point in the history
* test bash

* Set up Dependabot auto-merge & Must pass CI before merging

* Remove checkout action
  • Loading branch information
Pil0tXia authored Apr 17, 2024
1 parent b32ae9a commit e934ca2
Show file tree
Hide file tree
Showing 5 changed files with 64 additions and 5 deletions.
6 changes: 5 additions & 1 deletion .asf.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#

github:
description: EventMesh Dashboard
description: Apache EventMesh Dashboard
features:
# Enable issue management
issues: true
Expand All @@ -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
12 changes: 10 additions & 2 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,18 @@ 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"]
update-types: [ "version-update:semver-major" ]
- package-ecosystem: "npm"
directory: "./eventmesh-dashboard-view"
schedule:
interval: "monthly"
ignore:
- dependency-name: "*"
# Disable front-end PRs temporarily since 'npm run build' fails
update-types: [ "version-update:semver-major", "version-update:semver-minor", "version-update:semver-patch" ]
- package-ecosystem: "github-actions"
directory: "/"
schedule:
Expand Down
47 changes: 47 additions & 0 deletions .github/workflows/auto-merge-dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

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: Dependabot metadata
id: metadata
uses: dependabot/fetch-metadata@v2
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"

- 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}}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# EventMesh Dashboard
# Apache EventMesh Dashboard

[🌐 简体中文](README.zh-CN.md)

Expand Down
2 changes: 1 addition & 1 deletion README.zh-CN.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# EventMesh Dashboard
# Apache EventMesh Dashboard

[🌐 English Version](README.md)

Expand Down

0 comments on commit e934ca2

Please sign in to comment.