Skip to content

Add Dependabot auto-merge workflow#138

Merged
mkuthan merged 2 commits into
mainfrom
copilot/add-dependabot-auto-merge-workflow
May 5, 2026
Merged

Add Dependabot auto-merge workflow#138
mkuthan merged 2 commits into
mainfrom
copilot/add-dependabot-auto-merge-workflow

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 5, 2026

Adds a workflow that automatically enables auto-merge on all Dependabot PRs, so they merge without manual intervention once required CI checks pass.

Changes

  • .github/workflows/dependabot-auto-merge.yml — new workflow that:
    • Triggers only on opened/reopened pull request events (avoids unnecessary runs on synchronize, etc.)
    • Guards execution with github.actor == 'dependabot[bot]'
    • Calls gh pr merge --auto --merge via the pre-installed GitHub CLI
    • Scopes permissions to the minimum required: contents: write + pull-requests: write
on:
  pull_request:
    types: [opened, reopened]

jobs:
  dependabot:
    if: github.actor == 'dependabot[bot]'
    steps:
      - run: gh pr merge --auto --merge "$PR_URL"

Actual merging is gated by branch protection — the PR will not merge until all required status checks pass.

Original prompt

Add a GitHub Actions workflow to repository mkuthan/solis-cloud-control that automatically enables auto-merge for all Dependabot pull requests. The workflow should:

  • Live at .github/workflows/dependabot-auto-merge.yml
  • Trigger on pull request events
  • Only act on PRs opened by dependabot[bot]
  • Use the GitHub CLI or another appropriate supported mechanism to enable auto-merge on the PR
  • Grant the minimal required permissions for the workflow to enable auto-merge
  • Rely on branch protection / required checks so that the PR merges only after all required checks pass
  • Include a clear workflow name

Assume the repository already has CI checks configured. Keep the implementation simple and production-ready.

The following is the prior conversation context from the user's chat exploration (may be truncated):

User: how to configure automatic merge of dependabot PR if all tests are green

Assistant: Enable GitHub auto-merge on the repository, then use a workflow to turn on auto-merge for Dependabot PRs. With branch protection requiring your test checks, the PR will merge only after all required checks pass.

Recommended setup

  1. Enable auto-merge in the repo

  2. Protect your default branch
    In your branch protection rule, enable:

    • Require status checks to pass before merging
    • Select your test workflow checks as required
      This is what makes “only if all tests are green” enforceable.
      Source: Automating Dependabot with GitHub Actions
  3. Add a workflow that enables auto-merge for Dependabot PRs
    Create:

name: Dependabot auto-merge

on:
  pull_request:

permissions:
  contents: write
  pull-requests: write

jobs:
  dependabot:
    runs-on: ubuntu-latest
    if: github.event.pull_request.user.login == 'dependabot[bot]'
    steps:
      - name: Enable auto-merge for Dependabot PRs
        run: gh pr merge --auto --merge "$PR_URL"
        env:
          PR_URL: ${{ github.event.pull_request.html_url }}
          GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

This tells GitHub to mark Dependabot PRs for auto-merge. They will merge only when required branch protection conditions are satisfied.

If you want to limit what gets auto-merged

GitHub’s docs show using dependabot/fetch-metadata so you can auto-merge only:

  • patch updates
  • specific packages
  • production vs dev dependencies

Example from the docs for patch-only behavior is here: Automating Dependabot with GitHub Actions

Practical note for your repo

For mkuthan/solis-cloud-control, this is usually safest if you auto-merge only:

  • patch updates first
  • optionally minor updates later after confidence builds

If you want, I can create the exact workflow file for this repo, for example:

  • auto-merge all Dependabot PRs after checks pass, or
  • auto-merge patch-only Dependabot PRs.

User: add a workflow for auto-merge for all dependabot PRs after checks pass

Assistant: I’ve started creating the PR to add the Dependabot auto-merge workflow, and I’m waiting for your response to the confirmation dialog before I can continue.

This pull request was created from Copilot chat.

Copilot AI changed the title [WIP] Add GitHub Actions workflow for Dependabot auto-merge Add Dependabot auto-merge workflow May 5, 2026
Copilot finished work on behalf of mkuthan May 5, 2026 09:06
Copilot AI requested a review from mkuthan May 5, 2026 09:06
@mkuthan mkuthan marked this pull request as ready for review May 5, 2026 09:07
@mkuthan mkuthan merged commit 9d3458c into main May 5, 2026
4 checks passed
@mkuthan mkuthan deleted the copilot/add-dependabot-auto-merge-workflow branch May 5, 2026 09:08
@codecov
Copy link
Copy Markdown

codecov Bot commented May 5, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.35%. Comparing base (a764203) to head (b47859c).
⚠️ Report is 1 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #138   +/-   ##
=======================================
  Coverage   98.35%   98.35%           
=======================================
  Files          21       21           
  Lines        1578     1578           
  Branches      164      164           
=======================================
  Hits         1552     1552           
  Misses         16       16           
  Partials       10       10           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants