Reusable Workflow¶
The reusable workflow contains all the policy logic and can be called from any repository in your organization.
Location¶
Workflow Definition¶
name: Go Dependency Auto-Merge
on:
workflow_call:
inputs:
pr:
description: 'PR number to evaluate immediately (skips age check)'
required: false
type: string
default: ''
profile:
description: 'Merge profile'
required: false
type: string
default: 'quarantine'
min-age-days:
description: 'Minimum PR age in days'
required: false
type: number
default: 5
allowed-authors:
description: 'Comma-separated list of allowed PR authors'
required: false
type: string
default: 'dependabot[bot],renovate[bot]'
dry-run:
description: 'If true, only evaluate but do not merge'
required: false
type: boolean
default: false
go-version:
description: 'Go version for building versionconductor'
required: false
type: string
default: '1.26.x'
versionconductor-version:
description: 'Version of versionconductor to use'
required: false
type: string
default: 'latest'
secrets:
token:
description: 'GitHub token with PR permissions'
required: false
Required Permissions¶
The calling workflow must grant these permissions:
Policy Checks¶
The workflow evaluates these gates:
- Author Check - PR author must be in allowed list
- Age Check - PR must be at least N days old (unless manual dispatch)
- File Check - Only go.mod and go.sum changed
- Directive Check - No replace/exclude/retract/toolchain changes
- Go Version Check - No go version changes
- Merge State - PR must be mergeable (not draft, no conflicts)
Concurrency¶
The workflow uses concurrency groups to prevent parallel runs:
This ensures only one PR is processed at a time per repository.
One PR Per Run¶
The workflow processes only the oldest eligible PR per run. This avoids:
- Merge conflicts between concurrent PRs
- CI invalidation from base branch changes
- Rate limiting issues
With 15-minute schedule, you can process up to 96 PRs per day per repo.
Updating the Workflow¶
When you update the central workflow:
- All repos using
@mainget the update automatically - Repos pinned to a specific version need manual update
For production, consider pinning to a release tag:
Customization¶
To customize for your organization:
- Fork or copy the workflow to your
.githubrepo - Modify inputs, gates, or logic as needed
- Test with
dry-run: true - Roll out to repositories gradually