Skip to content

Make dependabot-automerge workflow reusable (workflow_call)#1

Merged
bbkrr merged 3 commits into
mainfrom
chore/dependabot-automerge-reusable
Jul 1, 2026
Merged

Make dependabot-automerge workflow reusable (workflow_call)#1
bbkrr merged 3 commits into
mainfrom
chore/dependabot-automerge-reusable

Conversation

@bbkrr

@bbkrr bbkrr commented Jul 1, 2026

Copy link
Copy Markdown
Collaborator

What

Convert .github/workflows/dependabot-automerge.yaml from an on: pull_request_target workflow into a reusable workflow (on: workflow_call).

Why

A plain workflow in the org .github repo only runs for the .github repo itself — it does not propagate to other repos. To share the approve + auto-merge logic org-wide, it must be a reusable workflow that other repos call.

Target repos add a thin caller at .github/workflows/dependabot-automerge.yaml:

on:
  pull_request_target:
    types: [opened, synchronize]
permissions:
  contents: write
  pull-requests: write
  issues: write
jobs:
  auto-merge:
    uses: realrate/.github/.github/workflows/dependabot-automerge.yaml@main
    secrets: inherit

Behavior

Unchanged: approve + enable auto-merge (rebase) for patch/minor bumps; comment + label needs-manual-review for major bumps. Only the trigger changed (pull_request_targetworkflow_call).

Part of the org-wide Dependabot auto-merge rollout (realrate/RealRate-Private#2148).

Convert the org auto-merge workflow from an on: pull_request_target
workflow (which only runs in the .github repo itself) into a reusable
workflow. Other repos add a thin caller that triggers on
pull_request_target and does 'uses: ...@main' with 'secrets: inherit',
so the approve + auto-merge logic lives in one place.

Behavior is unchanged (approve + enable auto-merge for patch/minor,
comment + label needs-manual-review for major).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
bbkrr and others added 2 commits July 1, 2026 11:52
Update the caller example to include the Dependabot-actor guard and a
default-branch restriction on pull_request_target.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
github.actor is the triggering user (can be a maintainer on a
rebase/synchronize), so guard the job on github.event.pull_request.user.login
instead. Update the caller example to match.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@bbkrr bbkrr merged commit 00d750f into main Jul 1, 2026
1 check passed
@bbkrr bbkrr deleted the chore/dependabot-automerge-reusable branch July 1, 2026 06:35
bbkrr added a commit that referenced this pull request Jul 1, 2026
GitHub's 'require workflows to pass' ruleset rejects a workflow_call-only
workflow ('must have merge_queue, pull_request_target, or pull_request').
Converting this to reusable (PR #1) broke the org dependabot-automerge
ruleset for every repo. Restore the direct pull_request_target trigger so
the org ruleset can inject and run it across repos as intended. Keeps the
PR-author guard.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
bbkrr added a commit that referenced this pull request Jul 1, 2026
…-workflow-trigger

Revert to pull_request_target: required workflows can't be reusable (fixes #1 regression)
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.

1 participant