Command-line tool for the management of pull requests in a GitHub organization and changes on Gerrit Code Review servers.
| Command | Description |
|---|---|
| merge | Bulk approve/merge pull requests (GitHub) or changes (Gerrit) |
| close | Bulk close pull requests across a GitHub organization |
| blocked | Reports blocked pull requests in a GitHub organization |
| status | Reports repository statistics for tags, releases, and PRs |
Bulk approves/merges similar pull requests across different repositories in a GitHub organisation, or similar changes on a Gerrit Code Review server.
By default, bypasses code owner review requirements to enable automated merging of dependency updates from the built-in automation tools:
- Dependabot
- pre-commit.ci
- Renovate
Dependamerge lists pull requests from any other GitHub App, such as GitHub
Copilot's coding agent or an organisation's own bots, and acts on them when a
bot policy includes that App. Use --include-bots and
--exclude-bots for one run, or a policy file to set it once.
Also works for human-authored pull requests, with --include-human-prs and the
--override value that confirms them; see
Human-Authored PRs.
Matches pull requests based on a heuristic that considers the criteria:
- Pull requests created by the same author/automation
- Pull requests with the same title/body content
- Pull requests containing the same package updates
- Pull requests changing the same files
When provided with a Gerrit change URL, the tool will:
- Detect the Gerrit server and authenticate using credentials
- Fetch details of the source change
- Search for similar open changes on the same server
- Apply +2 Code-Review and submit matching changes
Gerrit URL format:
https://gerrit.example.org/c/project/name/+/12345
https://gerrit.example.org/base/c/project/name/+/12345
Given a Gerrit query URL instead, the tool acts on the open changes the query matches, and no others:
https://gerrit.example.org/q/topic:some-topic
https://gerrit.onap.org/r/q/topic:gha-sonar-migration+is:open
- The query must contain a
topic:term, so it cannot match every open change on the server; it cannot have a top-levelORor negate the topic term. Atopic:inside a quoted or brace-quoted value (message:{see topic:x}) is text, not a term, and the tool keeps a brace-quoted value such asfile:{^src/(a|b)/}as written - Other terms, such as
project:,branch:or-label:Verified-1, narrow the batch as they do in the Gerrit UI - No change acts as an anchor: no similarity scoring, no owner matching and no rebase
- The preview lists every matched change; a change Gerrit already
reports as blocked gets skipped without a vote, counted in the final
tally, and makes the run exit
7. Blocked means work in progress, a vote at a label's lowest value such asVerified -1(or arejectedlabel on servers without submit requirements), one of the change's submit requirements reportingUNSATISFIEDorERROR, or a merge conflict. Code-Review reportingUNSATISFIEDdoes not count, since the run's own +2 meets it; Code-Review reportingERRORdoes - The tool fetches every page, and refuses to act on a result over 500 changes or one it cannot parse in full; a result spanning pages gets read again, and refused unless two reads agree
- Each change gets reviewed and submitted at the revision the preview listed; one with a newer patchset gets neither, and fails the run
- Every change gets its vote before any gets submitted, so a group Gerrit submits together goes in once each member has its +2; a change already merged along with another one of the batch counts as submitted, even when the tool's own vote on it failed
- The preview warns on each change you may lack +2 Code-Review on. Gerrit reveals submit permission on a change once that change becomes submittable, so the preview counts the changes where it could not check submit permission
- Before any vote, the tool asks Gerrit which changes each one would
submit with it (its unmerged ancestors, or its whole topic under
change.submitWholeTopic), and refuses the run when that reaches a change outside the batch, at another revision, or hidden from you; it asks again before each change's own vote --topicgets refused, since it would replace the query, and--thresholddoes not apply- Unless every change comes from automation, the batch needs
--include-human-prsand an--overridevalue bound to the host, the query and each change's number and current revision
Both Gerrit modes gate major version bumps, as described in docs/GERRIT_IMPLEMENTATION.md.
The tool automatically detects whether a URL is for GitHub or Gerrit based on
the URL pattern (/pull/ for GitHub, /c/.../+/ or /q/ for Gerrit).
Reports repository statistics across a GitHub organization, including:
- Latest tags and releases with synchronization status
- Open and merged pull request counts
- Pull requests affecting action files or workflow configurations
- Separate counts for human contributors and automation tools
Helps track release management and identify repositories needing attention. Supports both table and JSON output formats.
Lists blocked pull requests across a GitHub organization. Useful when successive merges have created conflicts or the need to rebase. Also lists pull requests blocked by branch protection rules, such as those with failed CI jobs, tests, etc.
Bulk closes similar pull requests across different repositories in a GitHub organisation. Works with the same automation tools as merge:
- Dependabot
- pre-commit.ci
- Renovate
- Other GitHub Apps a bot policy includes
Also works for human-authored pull requests, with --include-human-prs and the
--override value that confirms them.
Uses the same matching heuristic as merge to find similar PRs. Unlike merge, it requires PRs to be in the open state (no mergeable state checks needed).
Dependamerge provides four main functions:
- Finding Blocked PRs: Check entire GitHub organizations to identify pull requests with conflicts, failing checks, or other blocking issues
- Automated Merging (GitHub): Analyze a source pull request and find similar pull requests across all repositories in the same GitHub organization, then automatically approve and merge the matching PRs
- Automated Merging (Gerrit): Analyze a source change on a Gerrit Code Review server, find similar open changes, then apply +2 Code-Review and submit matching changes
- Bulk Closing: Analyze a source pull request and find similar pull requests across all repositories in the same GitHub organization, then close all matching open PRs
This saves time on routine dependency updates, maintenance tasks, and coordinated changes across all repositories while providing visibility into unmergeable PRs that need attention.
Works with any pull request or change regardless of author, automation tool, or origin. The tool automatically detects whether a URL is for GitHub or Gerrit based on the URL pattern.
- Comprehensive PR Analysis: Checks all repositories in a GitHub organization for unmergeable pull requests
- Blocking Reason Detection: Identifies specific reasons preventing PR merges (conflicts, failing checks, blocked reviews)
- Copilot Integration: Counts unresolved GitHub Copilot feedback comments (column shown when present)
- Smart Filtering: Excludes standard code review requirements, focuses on technical blocking issues
- Detailed Reporting: Provides comprehensive tables and summaries of problematic PRs
- Real-time Progress: Live progress display shows checking status and current operations
- Universal PR Support: Works with any pull request regardless of author or automation tool
- Smart Matching: Uses content similarity algorithms to match related PRs across repositories
- Bulk Operations: Approve and merge related similar PRs with a single command
- Security Features: SHA-based authentication for non-automation PRs ensures authorized bulk merges
- Interactive Mode by Default: Preview what changes will apply, then optionally proceed with merge
Pass a bare owner URL (e.g. https://github.com/lfreleng-actions) to merge
every in-scope automation pull request across an entire GitHub organisation
or user account in one command.
- Owner-Wide Scope: Enumerates every repository owned by the
organisation or user, then bulk merges their open automation PRs
(
dependabot,pre-commit-ciandrenovate, plus any App a bot policy includes); the summary lists PRs from other Apps as out of scope - Organisation or User: Detects the account type (org vs user) automatically at runtime; the same URL works for both
- Archived and Fork Exclusion: Leaves archived repositories out of the listing and the progress total, and excludes fork repositories by default (owner-wide merges target the owner's own repositories, not mirrored forks)
- Repository Scoping:
--include-reposlimits a run to the named repositories, and--exclude-reposkeeps the named ones out. A name matching no in-scope repository stops the run before anything merges, so a typo can neither shrink a run unnoticed nor leave an excluded repository exposed - Striped Sequencing: Schedules merges so that at most one PR per repository runs at a time while distinct repositories run concurrently. This spreads ("stripes") work across repositories and structurally avoids the data-replication races that otherwise arise when two same-repository PRs land back-to-back — without injected delays or random retries
- Drain Ordering: Orders repositories with the most PRs first (they take longest to drain), and merges PRs oldest-number-first within a repository to match the order dependabot expects to rebase
- Self-Rebase Awareness: Detects when dependabot has begun rebasing a
sibling PR (the "Dependabot is rebasing this PR" banner), holds that PR
in a background wait, and lets auto-merge land it rather than failing it
or firing a redundant rebase macro. A global
--max-waitceiling bounds the whole run - Resilient Enumeration: The run reports and skips a transient failure scanning one repository, then continues with the repositories it scanned
- Cumulative Activity Counters: The live progress line reports
⬆️ Rebased(rebase operations triggered — local force-push, RESTupdate-branch, or the@dependabot rebasemacro) and📣 Retriggered(comment macros posted:@dependabot rebase,@dependabot recreate,pre-commit.ci run). Both are running totals of operations, so they keep reporting what the run did after the PRs themselves have landed in✅ Merged/❌ Failed. A@dependabot rebaseheld back by--rebase-cooldownis not posted and counts under neither; the PR's status line gives the age of the last request and when the next is due - Draft Exclusion: The run lists draft PRs as skipped and never approves
or merges them, since a draft cannot merge until its author marks it ready.
The results document records them as skipped; a draft source PR stops the
run with exit code
6 - Grouped Preview: The preview lists candidate PRs grouped by repository for readability, then prompts for a confirmation token before merging
- Human PR Safety: The run excludes human-authored PRs by default;
--include-human-prsbrings them into scope, and--overrideconfirms the ones the run lists. Without the override the run prints its value and exits9, having merged nothing. A confirmed PR merges at the commit the run listed; see Commit Pinning
Note: Owner-wide merging works against
github.comand against any GitHub Enterprise Server host you declare. See GitHub Enterprise Server.
- Rich CLI Output: Beautiful terminal output with progress indicators and tables
- Real-time Progress: Live progress updates for both checking and merge operations
- Output Formats: Support for table and JSON output formats
- Error Handling: Graceful handling of API rate limits and repository access issues
- Any pull request from any author
- Manual pull requests from developers
- Automation tool pull requests (Dependabot, Renovate, pre-commit.ci)
- Pull requests from other GitHub Apps a bot policy includes
- Coordinated changes across repositories
This project uses:
- hatchling + hatch-vcs for dynamic (tag-based) versioning
- uv for environment + dependency management (produces/consumes
uv.lock)
Use uvx to run the latest published version directly from PyPI
(no virtualenv management needed):
# Show help (latest release)
uvx dependamerge --help
# Run a specific tagged release
uvx dependamerge==0.1.0 merge https://github.com/owner/repo/pull/123# 1. Install uv (if not already installed)
# macOS/Linux (script):
curl -LsSf https://astral.sh/uv/install.sh | sh
# or with pipx:
pipx install uv
# 2. Clone the repository
git clone <repository-url>
cd dependamerge
# 3. Create & activate a virtual environment (optional but recommended)
uv venv .venv
source .venv/bin/activate # (On Windows: .venv\Scripts\activate)
# 4. Install project + dev dependencies (uses dependency group 'dev')
uv sync --group devThe first sync will generate uv.lock. Commit that file to ensure reproducible
builds.
uv sync installs the project in editable (PEP 660) mode automatically.
After making changes you can run:
uv run dependamerge --helpThree Atheris harnesses in tests/fuzz/
exercise the code that reads input this tool does not control:
fuzz_url_parser.py: change URLs, shorthand targets, owner and repository names, the.gitsuffix helpers andredact_targetfuzz_untrusted_content.py: policy files, GitHub2Gerrit comments,.gitreviewand.netrcfuzz_redaction.py:redact_textandsummarise_error
Each module docstring names the contracts its harness checks. Atheris is not a project dependency; bring it for the run:
# Fuzz for a minute, keeping new inputs in corpus/
uv run --with atheris python tests/fuzz/fuzz_url_parser.py corpus/ -max_total_time=60
# Replay one input and exit
uv run --with atheris python tests/fuzz/fuzz_url_parser.py crash-<hash>tests/test_fuzz_replay.py replays every seed through each check in the
normal test suite, without Atheris.
Dynamic version comes from Git tags (e.g. tag v0.2.0 → version 0.2.0):
# Build wheel + sdist
uv build
# (Optional) Inspect dist/
ls dist/
# Publish to PyPI (ensure you have credentials configured)
uv publishIf you build before tagging, a local scheme like 0.0.0+local
(or similar) may appear—tag first for clean releases.
Edit pyproject.toml and then:
uv syncTo add a dev dependency:
uv add --group dev pytest-cov# Run a specific version in an ephemeral environment
uvx dependamerge==0.1.0 --helpThe repository root holds a composite action that runs dependamerge merge
from a workflow. It builds the tool from its own source at the commit you pin,
using the release's lock file for its dependencies and its build backend
alike, so the pin decides what runs.
jobs:
dependamerge:
runs-on: ubuntu-latest
permissions: {}
steps:
# yamllint disable-line rule:line-length
- uses: lfreleng-actions/dependamerge@<commit-sha> # vX.Y.Z
with:
target: my-org
exclude_repos: test-fixture-one,test-fixture-two
token: ${{ secrets.DEPENDAMERGE_TOKEN }}The action always runs non-interactively (--no-confirm --no-progress) on
Linux and macOS runners; it refuses Windows runners. It acts on GitHub alone: it
skips GitHub2Gerrit PRs and reports them as skipped (as it does a PR whose
comments it cannot read in full to rule out a mapping), and it withholds any Gerrit
credentials it inherits, so a Gerrit target fails rather than submitting
changes. It always addresses the GitHub server running the workflow: it refuses
a target on any other host and ignores host settings inherited from the caller.
It never offers a local signed rebase,
which needs a signing identity a runner lacks; see --rebase-local under
Merge Command Options.
The action runs its own uv and its own Python: a pinned uv, and a uv-managed
CPython 3.13 that it installs under RUNNER_TEMP and calls by absolute path.
Nothing an earlier step leaves in the job's environment, such as PATH,
UV_PYTHON, VIRTUAL_ENV, CONDA_PREFIX or a PYTHON* setting, chooses the
interpreter that builds and runs dependamerge, and the action ignores a
UV_CACHE_DIR the job sets. The action does trust the job's PATH for the
tools the runner and setup-uv start, such as bash and tar, so a caller that
puts its own executables there controls the job before this action runs. The
action fails at once when the job sets UV_NO_MODIFY_PATH, in any value, since
setup-uv would then leave PATH to name the uv a bare call finds. A runner
that restricts egress must allow uv's Python download as well as PyPI.
Each run writes a results table to the step summary, failures first, then
removes its results file. A run that leaves PRs failed or blocked fails the step
with exit code 7 after writing the summary. Set fail_on_merge_errors: false
when a later step reports those PRs instead.
| Input | Default | Description |
|---|---|---|
config |
JSON object of the options below, keyed by input name | |
target |
(required) | Owner, owner/repo, or pull request URL |
token |
${{ github.token }} |
Token able to approve and merge; read access suffices for a dry run |
dry_run |
false |
Assess every PR, merge nothing |
include_repos |
Owner-wide: act on these repositories alone (comma, space or newline list) | |
exclude_repos |
Owner-wide: act on every repository except these | |
include_bots |
Also act on PRs from these GitHub Apps; * for every App |
|
exclude_bots |
Never act on PRs from these GitHub Apps, built-in ones included | |
merge_method |
merge |
merge, squash or rebase |
force |
code-owners |
none, code-owners, protection-rules or all |
max_wait |
900 |
Owner-wide: wall-clock ceiling in seconds; 0 arms auto-merge and returns |
fix_out_of_date |
true |
Bring behind PRs up to date before merging |
dismiss_copilot |
false |
Dismiss unresolved GitHub Copilot review comments |
allow_major |
false |
Merge major version bumps; without it the run skips them |
gate_zero_minor |
false |
Hold back 0.x minor version bumps (0.7.0 to 0.8.0) as major ones |
fail_on_merge_errors |
true |
Fail the step when any PR ends failed or blocked |
slack_channel |
Slack channel ID; when set, slack_payload carries a digest of the run |
|
slack_when |
always |
Digest on always, activity (any PR processed), attention or never |
| Output | Description |
|---|---|
version |
The dependamerge version that ran |
exit_code |
dependamerge's exit code |
total |
Pull requests assessed or merged |
merged, auto_merge_pending, failed, blocked, unsettled, skipped, closed |
Pull requests ending with that outcome |
major_bumps |
Major version bumps merged; see below |
slack_payload |
Slack chat.postMessage JSON |
config holds a run's options as one JSON document, so a scheduled caller can
keep its scope in a repository or organisation variable and change it without
editing the workflow. Any of target, include_repos, exclude_repos,
include_bots, exclude_bots, merge_method, force, max_wait,
fix_out_of_date, dismiss_copilot, allow_major, gate_zero_minor and
dry_run may appear; repository and App lists may be arrays. An input given
explicitly wins over the config, and the config over the default. The action
checks every value before dependamerge runs, and an unknown key stops the run:
a misspelt exlude_repos must not widen it to every repository.
{
"target": "my-org",
"exclude_repos": ["test-fixture-one", "test-fixture-two"],
"max_wait": 900
}The count outputs stay empty when the run stops before reporting results, for
instance on an unknown exclude_repos name.
The Slack digest lists failed, blocked and skipped PRs with their reasons, then
the merges, and counts the outcomes that resolve on their own and any
major version bumps merged. It stays within
Slack's message limits for a run of any size, and counts the PRs it leaves out.
slack_when decides whether there is a digest at all: activity posts when the
run processed any PR, and attention when any PR failed or ended blocked.
Skipped PRs appear in a digest but never trigger one under attention.
The action builds the payload but does not post it, so the Slack token never
reaches the step holding the GitHub token; post it from your own step:
- name: Post digest
if: always() && steps.dependamerge.outputs.slack_payload != ''
# yamllint disable-line rule:line-length
uses: slackapi/slack-github-action@dcb1066f776dd043e64d0e8ba94ca15cc7e1875d # v4.0.0
with:
method: chat.postMessage
token: ${{ secrets.SLACK_BOT_TOKEN }}
payload: ${{ steps.dependamerge.outputs.slack_payload }}Pin the action to a release's commit SHA; Dependabot keeps such pins
current. The action reports the release that SHA belongs to as its version, and
an untagged commit as 0.0.0+g<short-sha>.
.github/workflows/dependamerge.yaml wraps the action for scheduled use: it
runs dependamerge, posts a Slack digest of what merged and what needs a human,
and posts a failure notice when a scheduled run breaks before its digest. It
needs github.com: it relies on the $/ self-repository reference and the
job.workflow_* context, which GitHub Enterprise Server lacks; there, use the
composite action directly. A thin caller is all a
repository needs:
name: 'Dependamerge 🤖'
on:
schedule:
- cron: '0 8 * * *'
workflow_dispatch:
permissions: {}
jobs:
dependamerge:
permissions:
contents: read
# yamllint disable-line rule:line-length
uses: lfreleng-actions/dependamerge/.github/workflows/dependamerge.yaml@<commit-sha> # vX.Y.Z
with:
config: ${{ vars.DEPENDAMERGE_CONFIG }}
slack_channel: ${{ vars.SLACK_CHANNEL_ID }}
environment: dependamerge
secrets:
# Map both secrets explicitly ('secrets: inherit' would pass every
# secret, which zizmor's secrets-inherit audit flags). Per GitHub's
# documentation, the job prefers the environment's own
# DEPENDAMERGE_TOKEN to the value mapped here.
DEPENDAMERGE_TOKEN: ${{ secrets.DEPENDAMERGE_TOKEN }}
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}You must set environment; it has no default. It names the environment in the
calling repository that gates the job, and GitHub creates a missing
environment without protection and without warning. Create it first, protect
it (for example with a deployment branch policy limited to the default
branch), and store the merge token there as an environment secret named
DEPENDAMERGE_TOKEN. GitHub documents that a reusable-workflow job naming an
environment uses that environment's secret in preference to one the caller
passes, so a workflow the environment does not admit cannot reach the token.
Map both secrets explicitly, as above. If the run cannot reach the token, it
stops at its first step and names the missing secret. Storing
DEPENDAMERGE_TOKEN as a repository or organisation secret instead also works,
but any workflow in the repository can read such a secret.
The workflow takes the action's merge options as inputs, config included,
with these additions:
| Input | Default | Description |
|---|---|---|
dry_run |
false |
Boolean: true forces a dry run; false leaves config to decide |
slack_channel |
Slack channel ID; empty disables Slack | |
slack_when |
activity |
Post the digest always, on activity (any PR processed), on attention or never |
fail_on_merge_errors |
false |
Fail the run when PRs end failed or blocked; the digest reports them either way |
environment |
(required) | Protected environment in the caller that gates the job and holds the merge token |
timeout_minutes |
60 |
Job timeout |
harden_runner_allowlist |
org list | Merge job's harden-runner egress allow-list coordinate, pinned; leave unchanged |
harden_runner_supplemental_allowlist |
Extra allow-list coordinate merged with harden_runner_allowlist; empty adds nothing |
|
harden_runner_supplemental_unpinned |
false |
Boolean: let the supplemental list omit @ref and follow its default branch; it must sit in the caller's organisation |
harden_runner_extra_endpoints |
Inline host[:port] endpoints, space or newline separated, merged into the allow-list; empty adds nothing |
Its secrets are DEPENDAMERGE_TOKEN, able to approve and merge across the
target, and SLACK_BOT_TOKEN. Without a Slack token the run still merges and
reports to its step summary, with a warning. A scheduled run that fails before
posting its digest (a bad merge token or configuration, or an environment gate
that rejected or never approved the job) posts a failure notice instead. The
notice job runs outside the environment, so the gate that stopped the run
cannot stop the notice too. It reads the SLACK_BOT_TOKEN the caller passes:
store that token where the caller can map it (a repository or organisation
secret) as well as in any environment. It holds no merge token, and keeps the
pinned default allow-list, which admits Slack, so a broken
harden_runner_* input cannot silence it. A digest Slack itself refuses (a
revoked token, a channel the bot cannot post to) fails the run but sends no
notice, since Slack would refuse the notice the same way; watch for the failed
run. A digest that fails for any other reason, such as a connection a custom
harden_runner_allowlist blocks, still gets the notice. Outputs merged,
failed, blocked, exit_code and digest_posted describe the run; in a dry
run the counts are predictions. The workflow fetches its action through $/,
so the commit you pin decides the workflow, the action and the tool together,
and Dependabot's github-actions ecosystem moves all three at once.
One run per calling workflow proceeds at a time; a run that starts while another is still merging waits for it.
Dependamerge supports both GitHub and Gerrit platforms, each with different authentication requirements.
You need a GitHub personal access token with appropriate permissions. The tool performs both read and write operations on GitHub repositories and pull requests.
Dependamerge supports both classic and fine-grained personal access tokens.
To configure a GitHub personal access token for use with dependamerge, go to:
https://github.com/
Then:
Profile → Settings → Developer settings → Personal access tokens
Fine-grained tokens → Generate new token
Required Repository Permissions:
- Contents: Read and write (for merging PRs and accessing file changes)
- Pull requests: Read and write (for creating reviews, approving, and merging)
- Workflows: Read and write (for PRs that change GitHub Actions workflows)
- Administration: Read access (for reading branch protection rules)
- Metadata: Read access (automatically included)
Required Account Permissions:
- Organization members: Read access (to access organization repositories)
Repository Access:
- Select "All repositories" or specify which repositories to access
Required Scopes:
read:org- Read organization membership, teams, and repositoriesworkflow- Update GitHub Actions workflows (needed for PRs modifying workflows)
One of the two options below is also needed:
public_repo- Access to public repositories (if working with public repos)repo- Full control of private repositories (includes all repository permissions)
- Read Operations: Access PR details, file changes, reviews, commits, check runs, and repository lists
- Write Operations: Create PR reviews (approvals), merge pull requests, update PR branches
Important Notes for Branch Protection:
- If repositories have branch protection rules enabled, these
requirements may apply:
- Required status checks: All CI/CD workflows must pass before merging
- Required reviews: PRs may need approval from code owners or specific teams
- Up-to-date branches: PRs may need to be current with the base branch
- Copilot review resolution: When using
--dismiss-copilot, the tool automatically handles all review types using dismissal or thread resolution as appropriate
- Default behavior: By default, dependamerge uses
--force=code-ownersto bypass code owner review requirements for automation PRs - For repositories with strict branch protection, use
--force=protection-rulesor--force=all, though the token owner may need admin permissions on individual repositories to bypass certain rules
Set the token as an environment variable:
export GITHUB_TOKEN=your_token_hereOr pass it directly to the command using --token.
To verify your token has the correct permissions:
# Test basic access
curl -H "Authorization: token $GITHUB_TOKEN" https://api.github.com/user
# Test organization access
curl -H "Authorization: token $GITHUB_TOKEN" \
https://api.github.com/orgs/YOUR_ORG/reposGerrit Code Review servers require HTTP credentials for API access. These are typically different from your SSO/LDAP login credentials.
- Log into your Gerrit server web interface
- Navigate to: Settings → HTTP Credentials
- Generate a new HTTP password if you don't have one
- Note your HTTP username (often your email or username)
Set the credentials as environment variables:
export GERRIT_USERNAME="your_username"
export GERRIT_PASSWORD="your_http_password"Alternative environment variable names are also supported for compatibility:
export GERRIT_HTTP_USER="your_username"
export GERRIT_HTTP_PASSWORD="your_http_password"Note: The GERRIT_USERNAME/GERRIT_PASSWORD variables take precedence
over GERRIT_HTTP_USER/GERRIT_HTTP_PASSWORD when you configure both.
To verify your Gerrit credentials:
# Test basic access (replace with your Gerrit server)
curl -u "$GERRIT_USERNAME:$GERRIT_PASSWORD" \
"https://gerrit.example.org/a/accounts/self"A successful response returns your account details in JSON format (with a
)]}'\n XSSI guard prefix that Gerrit adds to all JSON responses).
Dependamerge supports loading Gerrit credentials from .netrc files, following
the standard format used by curl and other tools.
Search order:
.netrcin the current directory~/.netrcin your home directory~/_netrc(Windows fallback)
Example .netrc file:
machine gerrit.onap.org login myuser password mytoken
machine gerrit.opendaylight.org login myuser password anothertoken
CLI options:
| Option | Description |
|---|---|
--no-netrc |
Disable .netrc file lookup |
--netrc-file PATH |
Use a specific .netrc file |
--netrc-optional |
Do not fail if .netrc file is missing (default) |
--netrc-required |
Require a .netrc file and fail if missing |
By default, .netrc lookup is optional (--netrc-optional): if no .netrc
file exists, the tool continues and falls back to environment variables.
Use --netrc-required to enforce that a .netrc file must be present.
When a .netrc file is present, the tool loads credentials automatically.
Explicit environment variables or CLI arguments take precedence over .netrc
entries.
merge and close accept shorthand as well as a full URL, and
status and blocked accept a bare owner login or an owner URL. The
shorthand saves a great deal of typing:
# Owner-wide: every repository beneath an org or user
dependamerge merge lfreleng-actions
# One repository
dependamerge merge lfreleng-actions/dependamerge
# One pull request
dependamerge merge lfreleng-actions/dependamerge/pull/7
# A git remote, as printed by `git remote -v`
dependamerge merge [email protected]:lfreleng-actions/dependamerge.gitFull URLs work as before, with or without the scheme. A trailing
.git makes no difference on a repository URL, which is what a
clone remote carries:
| Target | Trailing .git |
|---|---|
github.com/acme/widget.git |
removed — the same as github.com/acme/widget |
github.com/acme/widget/pull/7.git |
kept, so the URL stays invalid |
gerrit.example.org/q/topic:release.git |
kept, as part of the topic |
The suffix comes off where it can be a clone-URL artefact, and stays
put everywhere else. No clone URL names a pull request or a change, so
removing it there would turn a malformed target into a valid reference
to a change you did not name. In a Gerrit search the trailing text is a
value, so release.git is the topic you asked for.
Two segments are ambiguous — is a/b an owner and a repository, or a
host and an owner? A GitHub login cannot contain a dot, so a dotted
first segment names a host and an undotted one names a login:
| Input | Read as |
|---|---|
acme/widget |
repository widget owned by acme |
github.com/acme |
owner acme on github.com |
Omit the target entirely to act on the repository you are standing in:
cd ~/src/dependamerge
dependamerge mergeThe upstream remote takes precedence over origin, since in the fork
workflow origin names your own fork rather than the repository you
mean to merge. The tool prints the remote it chose before it does
anything.
The tool also recognises Gerrit checkouts — by .gitreview, by an SSH
remote on port 29418, or by the hostname — and prints the host and
project it found. You address a Gerrit change by change or topic, and a
checkout determines neither, so Gerrit still needs an explicit target.
Enterprise hosts work once you declare them. Their hostnames are arbitrary, so accepting whichever host a URL happens to name would send your token wherever a mistyped or pasted link points.
Declare one for a single run with --github-host, which every
target-taking command accepts:
dependamerge merge acme/widget --github-host ghe.corp.example.com
dependamerge status acme --github-host ghe.corp.example.comOr declare one for the shell session:
# One or more hosts, comma-separated
export DEPENDAMERGE_GITHUB_HOSTS=ghe.corp.example.com
dependamerge merge https://ghe.corp.example.com/acme/widgetTo set the host that shorthand resolves against, use
DEPENDAMERGE_GITHUB_HOST — or reuse GH_HOST, the GitHub CLI's own
variable, if you have already pointed gh at your instance:
export GH_HOST=ghe.corp.example.com
# Now shorthand resolves against the Enterprise host
dependamerge merge acme/widgetThe four settle in this order, highest priority first:
| Source | Sets the default | Declares the host |
|---|---|---|
--github-host |
yes | yes |
DEPENDAMERGE_GITHUB_HOST |
yes | yes |
GH_HOST |
yes | yes |
DEPENDAMERGE_GITHUB_HOSTS |
no | one or more |
Naming a host as your default also declares it, so there is no need to
set both. github.com needs no configuration.
The parsers accept a direct pull request URL on any host without
configuration, because /pull/ identifies one structurally. Acting on
it still needs the host declared, so the client refuses an Enterprise
pull request URL until you declare that host.
Gerrit hosts need no configuration. The tool recognises a Gerrit target
by the shape of its path — /c/<project>/+/<number> for a change,
/q/topic:<name> for a topic — so an ordinary Gerrit URL works as it
always has.
Declare a host when you want the path shape to stop deciding:
dependamerge merge https://review.corp.example.com/c/project/+/123 \
--gerrit-host review.corp.example.com
# Or for the shell session, comma-separated
export DEPENDAMERGE_GERRIT_HOSTS=review.corp.example.comDEPENDAMERGE_GERRIT_HOST names a single host, and --gerrit-host
adds one more. The sources combine rather than override each other,
since Gerrit has no default host for one of them to replace.
A declaration works in both directions. It routes that host to Gerrit whatever its URLs look like. It also stops a host you declared as GitHub from reaching the Gerrit client, which used to happen whenever a URL on it carried a Gerrit-shaped path, and produced a Gerrit credential error for a host you had named as GitHub.
Declaring the same host both ways reports the contradiction rather than picking one. Each declaration says where your credentials may go, so resolving a conflict by precedence would ignore one of them where it matters most.
This tool reads none of the GERRIT_* variables as a declaration.
GERRIT_HOST already chooses which server a GitHub2Gerrit change goes
to, and reusing it here would give an existing setting a second meaning.
Close pull requests across an entire GitHub organization:
# Close similar PRs from automation tools (dependabot, pre-commit.ci)
dependamerge close https://github.com/myorg/repo1/pull/45
# Close with no confirmation (immediate closing)
dependamerge close https://github.com/myorg/repo1/pull/45 --no-confirm
# Close with custom similarity threshold
dependamerge close https://github.com/myorg/repo1/pull/45 --threshold 0.9
# Close human-authored PRs: --include-human-prs, plus the --override value a
# run without it prints
dependamerge close https://github.com/myorg/repo1/pull/45 \
--include-human-prs --override a1b2c3d4e5f6g7h8The close command will:
- Analyze the provided PR
- Find similar PRs across the organization
- Close all matching PRs that are in the open state
- Skip PRs that are already closed or are drafts
Note: Unlike the merge command, the close command does not need to check mergeable state or branch protection rules. It requires PRs to be in the open state.
Report statistics for tags, releases, and pull requests:
# Basic organization status check
dependamerge status myorganization
# Using full GitHub URL
dependamerge status https://github.com/myorganization/
# Check with JSON output
dependamerge status myorganization --format json
# Disable real-time progress display
dependamerge status myorganization --no-progressThe status command will:
- Scan all repositories in the organization
- Report latest tags and releases with sync status indicators
- Count open and merged PRs (split by human/automation)
- Identify PRs affecting action files or workflow configurations
Status icons:
- ✅ Tag has matching release
⚠️ Tag exists but no matching release- ❌ Release is more recent than tag
Find blocked pull requests in an entire GitHub organization:
# Basic organization check for blocked PRs
dependamerge blocked myorganization
# Using full GitHub URL
dependamerge blocked https://github.com/myorganization/
# Check with JSON output
dependamerge blocked myorganization --format json
# Disable real-time progress display
dependamerge blocked myorganization --no-progressThe blocked command will:
- Analyze all repositories in the organization
- Identify PRs with technical blocking issues
- Report blocking reasons (merge conflicts, failing workflows, etc.)
- Count unresolved GitHub Copilot feedback comments (displayed when present)
- Exclude standard code review requirements from blocking reasons
The merge command supports both GitHub PRs and Gerrit changes. The platform is automatically detected from the URL format.
dependamerge merge \
https://github.com/lfreleng-actions/python-project-name-action/pull/22# Set credentials first
export GERRIT_USERNAME="your_username"
export GERRIT_PASSWORD="your_http_password"
# Merge similar changes
dependamerge merge \
https://gerrit.linuxfoundation.org/infra/c/releng/lftools/+/12345
# Merge the open changes a query matches, and no others
dependamerge merge --dry-run \
"https://gerrit.onap.org/r/q/topic:gha-sonar-migration+is:open"Dependamerge acts on automation by default. Acting on a person's pull
requests takes two flags, the same for merge and close, and for pull
request, repository, owner and Gerrit targets:
--include-human-prsbrings human-authored PRs into scope.--overrideconfirms which ones, with a value derived from them.
A run with the first flag alone prints that value and exits 9, so you can
review what it found, then run again with both:
dependamerge merge https://github.com/owner/repo/pull/123 --include-human-prs
# ...
# Run again with: --include-human-prs --override a1b2c3d4e5f6g7h8
dependamerge merge https://github.com/owner/repo/pull/123 \
--include-human-prs --override a1b2c3d4e5f6g7h8For a source pull request, or a Gerrit change, the value derives from its author and the first line of its commit message. For a Gerrit query URL, it derives from the host, the query and each matched change's number and current revision. For a repository or owner, it derives from the target and each human-authored PR's number and head commit, so a new push or another PR changes it. A dry run prints the value without requiring it.
| Situation | Exit code |
|---|---|
Human-authored source without --include-human-prs |
8 |
--include-human-prs without --override |
9 |
--override that does not match |
8 |
--override without --include-human-prs |
2 |
By default, dependamerge runs in interactive mode showing you what PRs the tool will merge, then prompts you to continue:
dependamerge merge https://github.com/owner/repo/pull/123Interactive Flow:
- Analyzes and shows similar PRs that the tool will merge
- Displays merge evaluation results
- Generates a unique SHA for security validation
- Prompts you to enter the SHA to proceed with actual merging
- Merges PRs that appear as "mergeable" in the preview
Example Output:
🔍 Dependamerge Evaluation
✅ Approve/merge: https://github.com/org/repo1/pull/45
⏭️ Skipped: https://github.com/org/repo2/pull/67 [cannot update protected ref]
✅ Approve/merge: https://github.com/org/repo3/pull/89
▶️ Mergeable 2/3 PRs
➡️ To proceed with merging enter: abc123def456
Enter the string above to continue (or press Enter to cancel):
🚀 Merging 2 pull requests...
▶️ Merging PRs in org (2/2 PRs, 100%)
✅ Merged: 2
⏱️ Elapsed: 16s
🚀 Final Results: 2 merged, 0 failedEvery pull request a run touches ends in a single category. Each category keeps its own counter, because each calls for a different response:
| Outcome | Meaning | What to do |
|---|---|---|
| ✅ Merged | The run merged it | Nothing |
| ⏳ Auto-merge pending | Armed; GitHub completes the merge once required checks pass | Nothing |
| ⏱️ Unsettled | The earlier refusal no longer applies | Re-run to merge it |
| ❌ Failed | A blocker remains, or the run hit an error | Investigate the reported reason |
| 🛑 Blocked | Will not merge without human help | Investigate |
| ⏭️ Skipped | Already merged externally, or out of scope | Nothing |
| 🚪 Closed | Closed without merging during the run | Nothing |
Unsettled is not a failure. GitHub's merge rejection describes the state at the instant of the attempt. That state can stop holding: a required check finishes, a rebase lands, a base branch settles. The run re-reads every failure before it prints the summary, and records a pull request whose refusal no longer applies as unsettled rather than failed. The failure count then holds work that genuinely needs attention.
A refusal GitHub made about the pull request is the one kind that clears this way. A failure the run itself hit — a missing token scope, a 502, a rebase that did not complete — stays reported, because a mergeable-looking PR says nothing about whether that will happen again.
A failure names the condition blocking the merge, which the run derives from live state rather than from the refusal's wording. Three sources feed it, and they carry different weight:
| Source | Carries | Reported as |
|---|---|---|
| commit status contexts | context name | blocked by required status check: when the branch requires it |
| Actions workflow runs | workflow name: |
blocked by required workflow: when the refusal named it |
| check runs | job name | also failing: — nothing here shows which jobs a branch requires |
That distinction keeps an advisory integration clear of blame for a
merge it never blocked. Anything under also failing (or failing checks, when the run proved nothing) is genuinely failing but carries
no evidence that the branch requires it — worth reading, though perhaps
not the cause.
The three do not overlap. pre-commit.ci and DCO report as status
contexts and stay invisible to check runs, while a workflow and its
jobs have different names: codeql.yml declares the workflow CodeQL
and the job Audit Repository, and a refusal quotes the first alone.
A pull request that bumps a dependency across a major version merges
as a patch bump does, so the run reports each one it merged as a
reminder to check that it did not break the repository. A bump is major
when the leading version number changes (1.3.3 to 2.0.0, 0.0.2 to
1.0.0, or a downgrade such as 3.1.0 to 2.9.0), when a Python
version's epoch changes (1!1.3.3 to 2!1.3.3), or when dependabot's
metadata marks it semver-major. A grouped update counts when any one of
its dependencies does.
The versions come from the lines dependabot and pre-commit.ci start
their descriptions with (Bumps … from … to …, Updates `…` from … to … and - [repository: old → new](…)), never from the release notes
and commit lists inside collapsed <details> blocks, which routinely
mention the dependency's own bumps. A title's from … to … serves when
the description names no versions, which is all the run reads from a
Renovate pull request. A commit or digest pin reads as unknown, and a
calendar-versioned dependency reads as major when its year rolls over.
Merging a major bump is a deliberate act, so the run gates it:
- A run with
--no-confirm, the action's runs included, holds every major bump back before the merge pass. It lists them with a hint to re-run with--allow-major, and records each as skipped with the reason, such asmajor version bump: foo 1.3.3 → 2.0.0, so the step summary and Slack digest show it. The rest merge, and a held-back bump leaves the exit code alone. - An interactive run lists the mergeable major bumps after its preview, apart from the rest, and asks for a value derived from those pull requests and their head commits alone. Entering it merges them with the rest; pressing Enter, entering anything else or ending the input leaves them out, recorded as skipped, and the run goes on to its usual confirmation for the rest. A new push, or another major bump joining the set, changes the value. When the pull request a run names is itself a major bump, naming it makes the choice: the run warns and asks for no second value. Before merging, the run reads each confirmed bump's head again and leaves out, recorded as skipped, any that moved since the run listed it, and merges the rest at the commit confirmed; see Commit Pinning.
- A dry run lists them and says what a real run would do.
--allow-major(the action'sallow_majorinput) turns the gate off in every mode.--gate-zero-minor(gate_zero_minor) gates 0.x minor bumps, such as0.7.0to0.8.0, the same way. A bump that reads as unknown is never gated.
A merged or auto-merge pending major bump appears:
- on the console, below the final results line, with its URL, the dependency and both versions (a dry run, and the preview shown before the confirmation prompt, list the mergeable ones);
- in the results document, where every entry carries a
bumpwith its level and updates, andmajor_bumpscounts the ones that merged; - in the step summary, as a
⚠️ Major version bumpstable; - in the Slack digest's count line; and
- in the action's
major_bumpsoutput.
Every merge, approval and auto-merge request names the commit it means, so GitHub refuses it when the pull request's head has moved since:
- A pull request a person confirmed merges at the commit they
confirmed, and at no other. A confirmed pull request is a major
bump the interactive value included or a single pull request run
named as its source, or a human-authored pull request
--overridebrought into the run. The run approves and merges it at that commit and never arms auto-merge for it. When its head moves, or the run itself asks for a rebase or recreate, the run leaves it for the next run, recorded as skipped with a reason that names the old and new commits or the request it made. The run also skips, before any approval, one that already has auto-merge enabled, since GitHub could merge a later commit; disable auto-merge and re-run. A skipped pull request leaves the exit code alone. - Every other pull request merges at the commit the run last
evaluated, and at no other. When GitHub refuses because the head
moved, the run reads the head again and retries at it, within the
usual retry bound; one that still does not merge fails with
head changed during the merge; re-run. The run arms auto-merge at the evaluated head; GitHub checks that head when auto-merge arms, and the repository's own rules govern what it merges later.
Use --dry-run to perform a complete analysis and preview without making any
changes. A dry run never approves, merges, rebases, or closes anything, and it
skips the write-permission pre-flight check, so it runs under a token without
write access. This makes it ideal for CI validation and for inspecting what
the tool would do before committing to it:
# Preview a single PR (and its similar PRs) without merging
dependamerge merge https://github.com/owner/repo/pull/123 --dry-run
# Preview an owner-wide run under a token without write access
dependamerge merge https://github.com/owner --dry-run --no-progress
# Preview which PRs close would target, without closing them
dependamerge close https://github.com/owner/repo/pull/123 --dry-run
# Preview a Gerrit change without applying +2 or submitting
dependamerge merge https://gerrit.example.org/c/project/+/12345 --dry-runThe repository's Integration Tests (dry-run) workflow exercises every
sub-command in this mode against live GitHub (and, when configured, Gerrit)
on each pull request, so it catches owner-resolution and command regressions
before release. The integration suite self-skips when credentials or open
automation PRs are absent, so it never fails on an empty target space.
When merge runs as a GitHub Actions step (the runner sets
GITHUB_ACTIONS=true), it also writes its results as JSON, with no flag
needed. The file goes into RUNNER_TEMP under an unpredictable name,
readable by its owner alone, and the step output results_file holds its
path. Every GitHub run that reaches its results writes one, including a dry
run and a run that found nothing to merge; a run that stops on an error
first (a bad option, a token without the rights) does not.
The document records the target, scope, any --include-repos or
--exclude-repos selection, the count of each outcome, one entry per pull
request (repository, number, title, URL, author, outcome, reason and
version bump), the number of major version bumps
merged, and any repositories an owner-wide run could not scan. Render it as
a step summary from a later step, mapping the output into the environment:
- name: Summarise
# Also after a failed merge (exit 7): dependamerge writes its
# results before exiting. Skipped when the run stopped earlier.
if: always() && steps.dependamerge.outputs.results_file != ''
env:
RESULTS_FILE: ${{ steps.dependamerge.outputs.results_file }}
run: |
python -m dependamerge.ci_report markdown "$RESULTS_FILE" \
>> "$GITHUB_STEP_SUMMARY"The target in the document passes through the same redaction as any displayed target, so a credential in its userinfo, query or fragment never reaches the file or anything rendered from it.
Outside GitHub Actions nothing changes. Gerrit runs do not write a results file.
dependamerge merge https://github.com/owner/repo/pull/123 \
--threshold 0.9 \
--merge-method squash \
--no-fix \
--no-progress \
--token your_github_tokenGitHub limits content-generating requests, such as reviews, comments, merges, branch updates and GraphQL mutations, to 80 a minute and 500 an hour (secondary rate limits). A bulk merge approves and merges every pull request, so 300 pull requests exceed the per-hour figure. Dependamerge paces these requests to 60 a minute and 450 in any rolling hour by default, leaving headroom for your other activity. Reads are not affected.
When GitHub signals a throttle, the tool halves that rate, pauses writes for the advised time (at least a minute), and recovers gradually once GitHub stops signalling. While the per-hour budget holds the run back, the progress display reports a wait on GitHub's content-creation limit.
To change the budget, set these environment variables:
export DEPENDAMERGE_CONTENT_PER_MINUTE=40
export DEPENDAMERGE_CONTENT_PER_HOUR=300--format TEXT: Output format - table or json (default: table)--progress/--no-progress: Show real-time progress updates (default: progress)--token TEXT: GitHub token (alternative to GITHUB_TOKEN env var)
--format TEXT: Output format - table or json (default: table)--progress/--no-progress: Show real-time progress updates (default: progress)--token TEXT: GitHub token (alternative to GITHUB_TOKEN env var)
General Options:
--no-confirm: Skip confirmation prompt and merge without delay (default is interactive mode). A run that merges exits with code7when any PR ends failed or blocked; see exit codes--dry-run: Analyze and preview without making changes - never approve, merge, rebase, or close anything. Skips the write-permission pre-flight so it runs under a token without write access (e.g. in CI). Implies preview mode and suppresses confirmation prompts. Works for GitHub PR, repository, and owner-wide URLs as well as Gerrit changes.--threshold FLOAT: Similarity threshold for matching PRs/changes (0.0-1.0, default: 0.8)--progress/--no-progress: Show real-time progress updates (default: progress)--verbose,-v: Enable verbose debug logging
GitHub-Specific Options:
--merge-method TEXT: Merge method - merge, squash, or rebase (default: merge)--no-fix: Disable automatic fixing of out-of-date branches (default: automatic fixing enabled)--rebase-local/--no-rebase-local: When a behind PR's base branch requires signed commits and its head carries a valid signature, or the PR comes frompre-commit-ci[bot], bring it up to date without breaking signatures (default: enabled). Dependabot PRs get the@dependabot rebasemacro, so dependabot re-signs its own rebase; others get a localgitclone, rebase and force-push signed with your own git configuration.--no-rebase-localuses the RESTupdate-branchendpoint for every PR instead, which leaves unsigned commits. Under GitHub Actions dependamerge refuses the localgitstep, since a runner has no signing identity: the macro still runs, and a PR that needs the local step fails with a reason asking for a manual rebase--no-fix-semantic-title: Disable repair of automation PRs whose title differs from their single commit's subject. Dependabot shortens the commit subject by dropping thefrom <old> to <new>fragment while the title keeps it, which permanently fails aSemantic Pull Requestcheck configured withvalidateSingleCommitMatchesPrTitle. By defaultdependamergesets the title to the commit subject, and GitHub'seditedevent re-runs the check. Three conditions gate the repair: that check is the sole failure, the PR has one commit, and the two strings differ by the elided fragment alone. A title differing by version signals genuine drift, whichdependamergeleaves for the check to reject.--dismiss-copilot: Automatically resolve unresolved GitHub Copilot reviews (dismissal + thread resolution)--force TEXT: Override level for bypassing safety checks -none(default),code-owners,protection-rules, orall. See Force Override System for detailed documentation--token TEXT: GitHub token (alternative to GITHUB_TOKEN env var)--rebase-cooldown HOURS: Hours to wait before posting@dependabot rebaseon the same PR again (default: 8, at most three requests a day). The newest such comment on the PR decides: one under 30 minutes old with the head unchanged since counts as a rebase still in flight, so the run waits for it; one younger than the cooldown means no rebase is due, so the run reports the PR as it stands without requesting a rebase or waiting for one.0turns the cooldown off, leaving the in-flight rule alone; a negative value is a usage error. Local rebases and RESTupdate-branchignore it--allow-major: Merge major version bumps like any other PR. Without it,--no-confirmholds them back and an interactive run asks for a value of their own; see Major Version Bumps--gate-zero-minor: Gate 0.x minor version bumps (0.7.0to0.8.0) as major ones--include-human-prs: Act on human-authored PRs too. Needs a matching--override; see Human-Authored PRs--override TEXT: Confirms the human-authored PRs--include-human-prsbrings into scope, with the value a run without it prints--include-bots NAMES: Act on PRs from these GitHub Apps as well as the built-in Dependabot, Renovate and pre-commit.ci. Comma-separated and/or repeatable; each entry isname,name[bot]orapp/name, and'*'includes every App--exclude-bots NAMES: Never act on PRs from these GitHub Apps, built-in ones included. A name matching no GitHub App stops the run with exit code 2 before anything merges. See Bot Policy
Owner-Wide Options:
-
--max-wait SECONDS: Global wall-clock ceiling for an owner-wide run (default: 900, 15 minutes). Clamps every per-PR auto-merge wait so the run cannot hang on slow CI. Set--max-wait 0for fire-and-forget: approve, arm auto-merge, report each PR as pending, and return at once without blocking (GitHub completes the merges after the tool exits). Applies to owner-wide runs; single-PR and single-repo modes ignore it. -
--include-repos NAMES: Act on these repositories alone. Comma-separated and/or repeatable; each entry isnameorowner/nameand matches case-insensitively. -
--exclude-repos NAMES: Act on every repository except these. Same format as--include-repos, and mutually exclusive with it.Both refuse a name matching no non-archived, non-fork repository of the owner, exiting with code 2 before anything merges. Both apply to owner-wide runs alone; any other target refuses them.
# Merge automation PRs in two repositories of an organisation dependamerge merge lfreleng-actions --include-repos dependamerge,.github # Merge everywhere except the test fixtures dependamerge merge lfreleng-actions \ --exclude-repos test-tags-calver --exclude-repos test-tags-semantic
Gerrit Environment Variables:
GERRIT_USERNAME: HTTP username for Gerrit authenticationGERRIT_PASSWORD: HTTP password for Gerrit authentication
Fallback variables:
GERRIT_HTTP_USER: HTTP username (fallback)GERRIT_HTTP_PASSWORD: HTTP password (fallback)
--no-confirm: Skip confirmation prompt and close without preview--dry-run: Analyze and preview without making changes - never close anything. Suppresses the confirmation prompt so it runs unattended under a token without write access (e.g. in CI).--threshold FLOAT: Similarity threshold for matching PRs (0.0-1.0, default: 0.8)--progress/--no-progress: Show real-time progress updates (default: progress)--debug-matching: Show detailed scoring information for PR matching--token TEXT: GitHub token (alternative to GITHUB_TOKEN env var)--include-human-prs/--override TEXT: Act on human-authored PRs, as formerge; see Human-Authored PRs--include-bots NAMES/--exclude-bots NAMES: Which GitHub Apps' PRs to act on, as formerge. See Bot Policy
- Parse Source PR: Analyzes the provided pull request URL and extracts metadata
- Organization Check: Lists all repositories in the same GitHub organization
- PR Discovery: Finds all open pull requests in each repository
- Content Matching: Compares PRs using different similarity metrics:
- Title similarity (normalized to remove version numbers)
- File change patterns
- Author matching
- Human Gate: A human-authored source needs
--include-human-prsand the--overridevalue that confirms it - Approval & Merge: For matching PRs above the threshold:
- Adds an approval review
- Merges the pull request
- Source PR Merge: Merges the original source PR that served as the baseline
The tool uses different algorithms to determine if PRs are similar:
- Removes version numbers (e.g., "1.2.3", "v2.0.0")
- Removes commit hashes
- Removes dates
- Normalizes whitespace
- Compares changed filenames using Jaccard similarity
- Accounts for path normalization
- Ignores version-specific filename differences
Combines different factors:
- Title similarity score
- File change similarity score
- Author matching (same automation tool)
# Check organization for blocked PRs
dependamerge blocked myorganization
# Get detailed JSON output
dependamerge blocked myorganization --format json > unmergeable_prs.json
# Check without progress display
dependamerge blocked myorganization --no-progress# Merge a dependency update across all repos
dependamerge merge https://github.com/myorg/repo1/pull/45# Merge documentation updates
dependamerge merge https://github.com/myorg/repo1/pull/12 --threshold 0.85# Merge a person's PR and the PRs like it, once a run has printed the
# confirming value
dependamerge merge https://github.com/myorg/repo1/pull/89 \
--include-human-prs --override f1a2b3c4d5e6f7g8# Set up Gerrit credentials
export GERRIT_USERNAME="your_username"
export GERRIT_PASSWORD="your_http_password"
# Merge similar changes on a Gerrit server
dependamerge merge \
https://gerrit.linuxfoundation.org/infra/c/releng/lftools/+/12345# Merge with higher similarity threshold
dependamerge merge \
https://gerrit.example.org/c/project/name/+/67890 \
--threshold 0.9# Skip confirmation prompt for automation
dependamerge merge --no-confirm \
https://gerrit.linuxfoundation.org/infra/c/releng/global-jjb/+/74080The --dismiss-copilot flag automatically resolves blocking Copilot reviews
using the most appropriate method:
# Merge with automatic Copilot review resolution (interactive mode)
dependamerge merge https://github.com/myorg/repo1/pull/67 --dismiss-copilot
# Interactive mode to see which Copilot items the tool will resolve, then
# choose to proceed (default behavior)
dependamerge merge https://github.com/myorg/repo1/pull/67 --dismiss-copilot
# Skip confirmation and merge without delay with Copilot dismissal
dependamerge merge https://github.com/myorg/repo1/pull/67 --dismiss-copilot --no-confirmComprehensive Resolution Strategy: The tool automatically uses the most appropriate method for each Copilot review:
- ✅ APPROVED reviews → Dismissed via GitHub API
- ✅ CHANGES_REQUESTED reviews → Dismissed via GitHub API
- ✅ COMMENTED reviews → Individual review threads resolved automatically
- ✅ Automatic fallback → No manual intervention required
The tool intelligently handles GitHub API limitations by automatically falling back to thread-level resolution for COMMENTED reviews, ensuring comprehensive coverage without requiring user intervention.
# See what changes will apply (default: fix out-of-date branches)
dependamerge merge https://github.com/myorg/repo1/pull/78 \
--threshold 0.9 --progressThe --force option provides tiered override levels for bypassing safety checks
when you have appropriate permissions.
# Bypass code owner review requirements (you are a code owner)
dependamerge merge https://github.com/myorg/repo1/pull/45 --force=code-owners
# Bypass branch protection validation (you have admin/bypass permissions)
dependamerge merge https://github.com/myorg/repo1/pull/67 --force=protection-rules
# Emergency override - attempt merge despite most warnings (use with caution)
dependamerge merge https://github.com/myorg/repo1/pull/89 --force=allForce Levels:
none(default): Respect all protectionscode-owners: Bypass code owner review requirementsprotection-rules: Bypass branch protection checks (requires permissions)all: Attempt merge despite most warnings (not recommended)
Dependamerge provides configurable safety levels to handle different repository protection scenarios:
none: Respect all protections and requirementscode-owners: Bypass code owner review requirements (default)protection-rules: Bypass branch protection checks (requires permissions)all: Attempt merge despite most warnings (not recommended)
The default code-owners level allows automated merging of dependency updates
even when repositories require code owner reviews, which is the most common
blocking scenario for automation PRs.
Examples:
# Use full safety (respect all protections)
dependamerge merge https://github.com/owner/repo/pull/123 --force=none
# Default behavior (bypass code owner requirements)
dependamerge merge https://github.com/owner/repo/pull/123
# Bypass branch protection rules (requires admin permissions)
dependamerge merge https://github.com/owner/repo/pull/123 \
--force=protection-rules
# Force merge despite most warnings (use with extreme caution)
dependamerge merge https://github.com/owner/repo/pull/123 --force=all- Mergeable Check: Verifies PRs are in a mergeable state before attempting merge
- Auto-Fix: Automatically update out-of-date branches by default
(use
--no-fixto disable) - Detailed Status: Shows specific reasons preventing PR merges (conflicts, blocked by checks, etc.)
- Similarity Threshold: Configurable confidence threshold prevents incorrect matches
- Interactive Mode by Default: Shows results then lets you choose to
proceed (use
--no-confirmto skip) - Detailed Logging: Shows which PRs match and why they match
- SHA-Based Validation: Provides unique SHA hash for security
- Author Isolation: When using SHA validation, processes PRs from the same author as source PR
- Commit Binding: SHA changes if commit message changes, preventing replay attacks
- Cross-Author Protection: When enabled, one author's SHA cannot work for another author's PRs
The tool now supports GitHub PR URLs with path segments:
# These URL formats now work:
dependamerge merge https://github.com/owner/repo/pull/123
dependamerge merge https://github.com/owner/repo/pull/123/
dependamerge merge https://github.com/owner/repo/pull/123/files
dependamerge merge https://github.com/owner/repo/pull/123/commits
dependamerge merge https://github.com/owner/repo/pull/123/files/diffThis enhancement allows you to copy URLs directly from GitHub's PR pages without worrying about the specific tab you're viewing.
The merge command also accepts repository and owner (organisation or
user) URLs, selecting the operation scope from the URL shape:
# Single PR
dependamerge merge https://github.com/owner/repo/pull/123
# Whole repository (all open automation PRs)
dependamerge merge https://github.com/owner/repo
dependamerge merge https://github.com/owner/repo/pulls
# Whole owner: every repository of an organisation or user
dependamerge merge https://github.com/owner
dependamerge merge https://github.com/owner/
dependamerge merge https://github.com/orgs/owner
dependamerge merge https://github.com/orgs/owner/repositories| URL shape | Scope |
|---|---|
.../owner/repo/pull/123 |
single PR |
.../owner/repo |
repository |
.../owner or .../orgs/owner |
owner-wide |
(If you already followed the Installation section, you can skip these repeated steps.)
git clone <repository-url>
cd dependamerge
uv venv .venv
source .venv/bin/activate
uv sync --group devThe dev dependency group mirrors the legacy .[dev] extra.
uv run pytestYou can pass args as usual:
uv run pytest -k "similarity and not slow" -vvLive integration tests (under tests/integration/) drive the real CLI in
--dry-run mode against GitHub and Gerrit, exercising every sub-command
(status, blocked, merge, close) against both organization and personal
accounts and across every supported owner-URL form. Pytest deselects them by
default; opt in via --run-integration (or DEPENDAMERGE_RUN_INTEGRATION=1).
Each test fails safe: it skips when its credentials or an open automation PR are
not available, so it never mutates a repository and never fails on an empty
target space.
# GitHub integration tests (needs a token; a token without write access works)
GITHUB_TOKEN=... uv run pytest tests/integration --run-integration --no-cov
# Point at different targets (defaults: org lfreleng-actions,
# user ModeSevenIndustrialSolutions)
DEPENDAMERGE_IT_ORG=my-org DEPENDAMERGE_IT_USER=my-user \
GITHUB_TOKEN=... uv run pytest tests/integration --run-integration --no-cov
# Gerrit integration test (skips unless the host and credentials are present)
DEPENDAMERGE_IT_GERRIT_HOST=gerrit.example.org \
DEPENDAMERGE_IT_GERRIT_BASE_PATH=r \
GERRIT_USERNAME=... GERRIT_PASSWORD=... \
uv run pytest tests/integration/test_live_gerrit.py --run-integration --no-covThe Integration Tests (dry-run) GitHub Actions workflow runs this suite, with
read-scoped permissions, on pull requests to main or master that change the
source, the tests, pyproject.toml or the workflow itself.
This project uses prek (a faster, Rust-based drop-in replacement for pre-commit) as the local hook runner. The hooks run linting and formatting checks on commit; they do not run the test suite.
# Install prek git hooks
prek install
# Run all hooks manually
prek run --all-filesCI does not test every pull request. .github/workflows/build-test.yaml runs on
pull requests to main or master that change more than files under
.github/, root dotfiles and tox.ini;
.github/workflows/integration-test.yaml runs on those that change the source,
the tests or pyproject.toml. A pull request whose changes all fall outside
those filters, such as one to .pre-commit-config.yaml, triggers neither, so
run the tests locally with uv run pytest before you push; for a change the
workflows skip, that local run is the test run.
# Format
uv run ruff format src tests
# Lint
uv run ruff check src tests
# Type checking
uv run mypy srcpyproject.toml pins the ruff version to match the ruff-pre-commit
rev in .pre-commit-config.yaml, so these commands produce the same
result as the hooks and CI.
- Fork the repository
- Create a feature branch
- Add tests for new functionality
- Ensure all tests pass
- Submit a pull request
Apache-2.0 License - see LICENSE file for details.
❌ GitHub token required
Details: Provide --token or set the GITHUB_TOKEN environment variable
The run exits with code 2 (configuration error). Solution: Set
GITHUB_TOKEN environment variable or use --token flag.
Failed to fetch organization repositories
Solution: Ensure your token has the required permissions:
- Classic tokens:
read:orgscope - Fine-grained tokens: "Organization members: Read access" permission
403 Forbidden during merge attempt
Solution: Ensure your token has write permissions:
- Classic tokens:
reposcope (orpublic_repofor public repositories) - Fine-grained tokens: "Contents: Read and write" permission
Failed to approve PR: Missing 'Pull requests: Read and write' permission
Solution: Ensure your token can create PR reviews:
- Classic tokens:
reposcope (includes PR review permissions) - Fine-grained tokens: "Pull requests: Read and write" permission
Failed to check PR status
Solution: Add workflow/actions permissions:
- Classic tokens:
workflowscope - Fine-grained tokens: "Workflows: Read and write" permission
- Check that other repositories have open automation PRs
- Try lowering the similarity threshold with
--threshold 0.7 - Use interactive mode (default) to see detailed matching information and optionally proceed with merge
- Ensure PRs are in mergeable state (no conflicts)
- Check that you have write permissions to the target repositories
- Verify the repository settings permit the merge method
❌ Gerrit credentials not found in environment.
Solution: Set the required environment variables:
export GERRIT_USERNAME="your_username"
export GERRIT_PASSWORD="your_http_password"Note: These are your HTTP credentials from Gerrit, not your SSO/LDAP password. Generate them in Gerrit under Settings → HTTP Credentials.
❌ Gerrit authentication failed
Solution:
- Verify your HTTP credentials are correct
- Check that you have permission to access the Gerrit server
- Ensure the server URL is correct and accessible
- Try testing with curl:
curl -u "$GERRIT_USERNAME:$GERRIT_PASSWORD" \
"https://gerrit.example.org/a/accounts/self"❌ Invalid URL: Cannot determine platform for URL
Solution: Ensure your Gerrit URL follows the correct format:
https://gerrit.example.org/c/project/name/+/12345https://gerrit.example.org/base/c/project/name/+/12345
The URL must contain /c/ and /+/ for the tool to recognize it as a Gerrit change.
- Check the command help (local dev):
uv run dependamerge --help - For PyPI usage:
uvx dependamerge --help - Enable verbose output with
--verboseor-v - Review similarity scoring in interactive mode (default behavior)
Dependamerge handles authentication tokens (GitHub PATs, Gerrit HTTP credentials) and applies the following layers of protection to prevent accidental exposure:
- Token Redaction — All git operations redact tokens from logs and
error messages. The
git_opsmodule recognises GitHub classic tokens (ghp_), fine-grained tokens (github_pat_), App installation tokens (ghs_), user-to-server tokens (ghu_), OAuth access tokens (gho_), refresh tokens (ghr_), GitLab tokens (glpat-), basic-auth URLs, andx-access-tokenURLs - Safe Object Representation — All classes that store credentials
(
GitHubClient,GitHubAsync,AsyncMergeManager,AsyncCloseManager,GerritRestClient,GerritCredentials,NetrcCredentials) define__repr__methods that mask sensitive values - Log Hygiene — Credential values (tokens, passwords, or usernames) never appear in log output at any level. Debug logs record credential sources (e.g., "environment variables", ".netrc") but never the credential values themselves
- Scoped Debug Logging — The
--verboseflag enables DEBUG level logging for thedependamerge.*namespace; third-party libraries (includinghttpx, which logs request headers at TRACE level) remain at WARNING - Exception Sanitisation — Git command errors redact token patterns
from all stored attributes (
args_vec,stdout,stderr)
URL hostname checks use urlparse()-based exact matching via the
_host_matches() function, not substring checks. This prevents bypass
attacks where a crafted hostname (e.g., evil-github.com.attacker.net)
could fool a naïve substring check into trusting a malicious host.
- Store GitHub tokens securely (environment variables, not in code)
- Use tokens with minimal required permissions for your use case
- Rotate access tokens periodically
- Review PR changes in interactive preview mode first
- Be cautious with low similarity thresholds
- Consider using repository-specific tokens instead of organisation-wide access when possible
- Audit token permissions and revoke unused tokens periodically
- Store Gerrit HTTP credentials securely (environment variables, not in code)
- Use HTTP credentials generated specifically for API access, not your main password
- Regenerate HTTP credentials periodically in Gerrit Settings → HTTP Credentials
- Review changes in interactive preview mode before submitting
- Be aware that the tool performs +2 Code-Review and submit operations using your credentials
- Ensure you have appropriate permissions on the Gerrit server before running bulk operations