Skip to content

Commit

Permalink
💚 Dependabot の自動マージワークフローを追加
Browse files Browse the repository at this point in the history
  • Loading branch information
tatsutakein committed Jan 5, 2024
1 parent 4529126 commit 3207079
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions .github/workflows/dependabot-auto-merge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: "Dependabot auto-merge"

on:
pull_request: ~

permissions:
contents: write
pull-requests: write

jobs:
dependabot:
runs-on: ubuntu-22.04
if: github.actor == 'dependabot[bot]'
steps:
# https://github.com/marketplace/actions/create-github-app-token
- name: Create GitHub App Token
uses: actions/create-github-app-token@v1.6.2
id: app-token
with:
app-id: ${{ vars.BOT_APP_ID }}
private-key: ${{ secrets.BOT_PRIVATE_KEY }}

# https://github.com/marketplace/actions/fetch-metadata-from-dependabot-prs
- name: Dependabot metadata
id: metadata
uses: dependabot/fetch-metadata@v1.6.0
with:
github-token: "${{ steps.app-token.outputs.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 review --approve "$PR_URL"
gh pr edit "$PR_URL" -t "(auto merged) $PR_TITLE"
gh pr merge --auto --merge "$PR_URL"
env:
PR_URL: ${{ github.event.pull_request.html_url }}
PR_TITLE: ${{ github.event.pull_request.title }}
GH_TOKEN: ${{ steps.app-token.outputs.token }}

0 comments on commit 3207079

Please sign in to comment.