Skip to content
This repository was archived by the owner on Aug 12, 2026. It is now read-only.
This repository was archived by the owner on Aug 12, 2026. It is now read-only.

Automate Dependabot merges after CodeRabbit approval #131

Closed

Description

@acgetchell

Goal

Automatically squash-merge Dependabot updates only after CodeRabbit approves them and every protected-branch requirement passes.

Current state

  • Repository auto-merge and automatic head-branch deletion are already enabled.
  • The active main ruleset already requires CodeRabbit, the main build, ASan/UBSan, and LSan with strict status-check enforcement.
  • Required approvals are currently 0.
  • Required review-thread resolution is already enabled.
  • .coderabbit.yaml has request_changes_workflow: true, commit_status: true, and automatic reviews enabled, but does not explicitly fail the commit status when CodeRabbit cannot review.
  • GitHub Actions updates are not grouped.
  • No Dependabot review/auto-merge workflow exists.
  • Default Actions permissions are read-only; workflows may request explicit job permissions. Actions should not approve reviews—CodeRabbit should.

Implementation

  • Set reviews.fail_commit_status: true explicitly in .coderabbit.yaml.
  • Add a github-actions group matching "*" to .github/dependabot.yml.
  • Add .github/workflows/dependabot-auto-merge.yml:
name: Dependabot review and auto-merge

on:
  pull_request:
    types:
      - opened
      - reopened
      - ready_for_review

permissions:
  contents: write
  issues: write
  pull-requests: write

jobs:
  review-and-enable-auto-merge:
    if: >-
      github.event.pull_request.user.login == 'dependabot[bot]' &&
      github.repository == 'acgetchell/CDT-plusplus'
    runs-on: ubuntu-latest
    steps:
      - name: Request CodeRabbit review
        env:
          GH_TOKEN: ${{ github.token }}
          PR_URL: ${{ github.event.pull_request.html_url }}
        run: gh pr comment "$PR_URL" --body "@coderabbitai review"

      - name: Enable auto-merge
        env:
          GH_TOKEN: ${{ github.token }}
          PR_URL: ${{ github.event.pull_request.html_url }}
        run: gh pr merge --auto --squash "$PR_URL"
  • After the checked-in automation reaches main, update ruleset main:
    • require exactly one approving review;
    • preserve required review-thread resolution;
    • keep code-owner and last-push approval requirements disabled;
    • keep strict status checks enabled;
    • preserve deletion, bypass actors, merge methods, and every existing required check;
    • keep CodeRabbit bound to the CodeRabbit GitHub App.
  • Leave repository Actions approval permission disabled.

Acceptance criteria

  • A new Dependabot PR receives an explicit @coderabbitai review request and has squash auto-merge enabled.
  • It cannot merge while CodeRabbit is pending, skipped, failed, or requesting changes.
  • It cannot merge until CodeRabbit has approved, all existing required checks pass on the latest base, and all review threads are resolved.
  • Human-authored PRs keep the same CodeRabbit-required workflow.
  • Existing required checks and ruleset bypasses remain unchanged.

Validation

  • Run the repository's documented YAML/configuration checks, including actionlint and workflow security validation.
  • Verify the live ruleset after updating it.
  • Open or reopen a Dependabot PR and confirm CodeRabbit approval plus all protected checks results in automatic squash merge.

Activity

  1. added a commit that references this issue on Jul 29, 2026
  2. acgetchell commented on Jul 31, 2026

    @acgetchell
    OwnerAuthor

    Resolved.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions