Skip to content

Commit

Permalink
ci: Add dependabot_auto_merge.yaml
Browse files Browse the repository at this point in the history
  • Loading branch information
sorairolake committed Oct 9, 2024
1 parent 2d238b6 commit 06c8b0c
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/dependabot_auto_merge.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# SPDX-FileCopyrightText: 2024 Shun Sakai
#
# SPDX-License-Identifier: Apache-2.0 OR MIT

name: Dependabot auto-merge

on: pull_request_target

permissions:
contents: write
pull-requests: write

jobs:
dependabot:
name: Dependabot auto-merge
if: github.actor == 'dependabot[bot]' && github.repository_owner == 'sorairolake'
runs-on: ubuntu-22.04
steps:
- name: Dependabot metadata
id: metadata
uses: dependabot/fetch-metadata@v2.2.0
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' || steps.metadata.outputs.update-type == 'version-update:semver-minor' }}
run: gh pr merge --auto --squash "$PR_URL"
env:
PR_URL: ${{ github.event.pull_request.html_url }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit 06c8b0c

Please sign in to comment.