Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions .github/workflows/auto-merge-dependabot-dependency-updates.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Automatically merge (using squash) dependency update PRs, opened by Dependabot, under the following conditions:
#
# - PR was opened by dependabot[bot].
# - Dependency update is a minor or patch update. This is determined based on Dependabot's metadata.
# - Configured required checks pass.
#
# PRs are approved and merged by user codacybeta (https://github.com/orgs/codacy/people/codacybeta), using its
# AUTO_MERGE_TOKEN.
name: Auto-merge Dependabot dependency updates

on:
pull_request:

jobs:
auto-merge:
name: Auto-merge Dependabot dependency updates
runs-on: ubuntu-latest
if: github.event.pull_request.user.login == 'dependabot[bot]'
steps:
- name: Checkout repository
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
- name: Get Dependabot metadata
id: metadata
uses: dependabot/fetch-metadata@21025c705c08248db411dc16f3619e6b5f9ea21a # v2
with:
github-token: ${{ secrets.AUTO_MERGE_TOKEN }}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔴 HIGH RISK

The requested approval and merge behavior will not occur if AUTO_MERGE_TOKEN is an ordinary organization secret, because secrets are restricted for Dependabot-triggered workflows; configure it as a Dependabot-available secret or use an appropriately supported trigger and token mechanism.

TIP React 👍 if this review is right, or reply with what's wrong and how it could be better to help improve the reviewer.

- name: Approve PR and set it to auto-merge
if: steps.metadata.outputs.update-type == 'version-update:semver-patch' || steps.metadata.outputs.update-type == 'version-update:semver-minor'
run: |
gh pr review --approve ${{ github.event.pull_request.number }}
gh pr merge --squash --auto ${{ github.event.pull_request.number }}
env:
GH_TOKEN: ${{ secrets.AUTO_MERGE_TOKEN }}
17 changes: 0 additions & 17 deletions .github/workflows/auto-merge.yml

This file was deleted.