Reference

MassApplyPatch.allow_automerge!Function
allow_automerge!(repos, enable::Bool = true; token=ENV["GITHUB_TOKEN"], api=GitHub.DEFAULT_API)

Enable or disable the repository-level "Allow auto-merge" setting for each "OWNER/REPO" in repos, for example allow_automerge!(["ITensor/SparseArraysBase.jl"], true) to enable it or allow_automerge!(["ITensor/SparseArraysBase.jl"], false) to disable it.

Returns: Dict("OWNER/REPO" => (ok::Bool, status::Int, message::String))

source
MassApplyPatch.close_pr!Method
close_pr!(pr; delete_branch=false, comment=nothing, ignore_errors=true)

Close a GitHub pull request using the gh CLI.

pr may be a PR URL like https://github.com/ORG/REPO/pull/123 (recommended), a PR number, or any identifier accepted by gh pr close.

If comment is provided, posts a PR comment after closing. Returns true if the close command succeeded, false otherwise (unless ignore_errors=false).

Requires: gh installed and authenticated (gh auth login).

source
MassApplyPatch.latest_prMethod
latest_pr(repo::AbstractString; state::AbstractString="open")

Return a named tuple (url, branch, title) (all String) for the most recently-updated PR in repo (format: "OWNER/REPO"), or nothing if none exist.

source
MassApplyPatch.mainMethod
MassApplyPatch.main(argv)

Command line interface for MassApplyPatch.

Arguments:

  • argv: Command line arguments. Expected format: massapplypatch <org/repo>... –patch=<patchname>... [–notrigger-patch=<patchname>...] [–branch=branchname] [–title=prtitle] [–body=prbody]

The patch function should be provided as a Julia file, which is included and must define a function patch(repo_path).

source
MassApplyPatch.merge_prs!Method

Merge PRs (REST API).

  • pr_urls: ["https://github.com/OWNER/REPO/pull/123", ...]
  • merge_method: "merge" | "squash" | "rebase"
  • sha: optional safety check (merge only if head SHA matches)
  • force: if true and the REST merge fails, retry via gh pr merge --admin
source
MassApplyPatch.protect_branch!Method
protect_branch!(repos;
    checks::Vector{String},
    branch::Union{Nothing,String}=nothing,
    api::GitHub.GitHubAPI=GitHub.DEFAULT_API,
    strict::Bool=true,
    enforce_admins::Bool=false,
    require_pr::Bool=true,
    required_approvals::Int=1,
    require_code_owner_reviews::Bool=false,
    dismiss_stale_reviews::Bool=true,
    require_linear_history::Bool=true,
    allow_force_pushes::Bool=false,
    allow_deletions::Bool=false,
) -> Dict{String,Tuple{Bool,Int,String}}

Apply branch protection to each repo in repos.

  • checks are the required status check contexts (exact names).
  • branch=nothing means “use each repo's default branch”.
source