Skip to content

Commit

Permalink
feat: Add automerge for dependabot and renovate-bot (GoogleCloudPlatf…
Browse files Browse the repository at this point in the history
  • Loading branch information
romanini-ciandt authored Nov 1, 2024
1 parent 6f8c097 commit fa66911
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 1 deletion.
3 changes: 2 additions & 1 deletion .github/renovate.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": ["github>GoogleCloudPlatform/cloud-foundation-toolkit//infra/terraform/test-org/github/resources/renovate"]
"extends": ["github>GoogleCloudPlatform/cloud-foundation-toolkit//infra/terraform/test-org/github/resources/renovate"],
"automerge": true
}
45 changes: 45 additions & 0 deletions .github/workflows/dependabot-automation.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Copyright 2024 Google LLC
#
# Licensed 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 automation

on: # yamllint disable-line rule:truthy
pull_request:
types:
- opened
- synchronize

permissions:
contents: write
pull-requests: write

jobs:
dependabot:
env:
PR_URL: ${{github.event.pull_request.html_url}}
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
runs-on: ubuntu-latest
if: github.actor == 'dependabot[bot]'
steps:
- name: Fetch Dependabot metadata
id: metadata
uses: dependabot/fetch-metadata@v2
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"
- name: Approve the PR
run: gh pr review --approve "${PR_URL}"
- name: Enable auto-merge for PRs
run: gh pr merge --auto --squash --delete-branch "${PR_URL}"
...

0 comments on commit fa66911

Please sign in to comment.