Reference

MassApplyPatch.add_compat_entries!Method
add_compat_entries!(project_toml; include_weakdeps=true, include_julia=nothing)

Add missing [compat] entries in a Project.toml file. Existing [compat] entries are preserved as-is.

Missing entries are computed as:

  • package names in [deps] (and optionally [weakdeps])
  • minus existing package names in [compat]

By default, julia compat is added only for package projects (those with both name and uuid fields). For sub-environments like test/docs/examples, julia compat is skipped unless include_julia=true is passed explicitly.

source
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_issue!Method
close_issue!(issue; delete_branch=false, comment=nothing, ignore_errors=true)

Close a GitHub issue or pull request using the gh CLI.

issue may be an issue/PR URL like:

  • https://github.com/ORG/REPO/issues/123
  • https://github.com/ORG/REPO/pull/123 or any identifier accepted by gh issue close / gh pr close.

If issue points to a PR and delete_branch=true, the PR branch is deleted after close. If comment is provided, posts a 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.create_issues!Method
create_issues!(
    repos::AbstractVector{<:AbstractString};
    title::AbstractString,
    body::AbstractString = "",
    labels::AbstractVector{<:AbstractString} = String[],
    pin::Bool = false
)

Create a new issue with the given title and body in each repository of repos (format: "OWNER/REPO"). Returns a Vector of named tuples (; url) with the URL of each created issue. If pin=true, the issue is pinned after creation.

source
MassApplyPatch.delete_branches!Method
delete_branches!(f, repos; ignore_errors=true, api=GitHub.DEFAULT_API)

Delete branches in each repository from repos when f(branch_name) is true.

repos should contain entries like "OWNER/REPO".

Returns a vector of named tuples: (repo, branch, ok, status, message).

source
MassApplyPatch.filter_open_issuesMethod
filter_open_issues(
    repos::AbstractVector{<:AbstractString}, predicate::Function;
    sort="updated", direction="desc"
)

Return a flattened Vector of open issues from all repos that satisfy predicate. predicate should accept a named tuple (url, title, body).

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!(pr_urls::AbstractVector{<:AbstractString}; kwargs...)

Merge PRs via gh pr merge.

Keyword arguments:

  • force::Bool=false: bypass requirements and merge immediately (false is equivalent to --auto, true is equivalent to --admin).
  • merge_method::AbstractString="squash": merge strategy, one of "merge", "squash", or "rebase".
  • commit_title::Union{Nothing, String}=nothing: custom commit title (equivalent to --subject).
  • commit_message::Union{Nothing, String}=nothing: custom commit message (equivalent to --body).
source
MassApplyPatch.open_issuesMethod
open_issues(repos::AbstractVector{<:AbstractString}; sort="updated", direction="desc")

Return a Vector of named tuples (url, title, body) (all String) for all open issues in each repository of repos (format: "OWNER/REPO"), sorted by most recently updated first. Pull requests are excluded.

source
MassApplyPatch.open_prsMethod
open_prs(repos::AbstractVector{<:AbstractString}; sort="updated", direction="desc")

Return a Vector of named tuples (url, branch, title, body) (all String) for all open PRs in each repository of repos (format: "OWNER/REPO"), sorted by most recently updated first.

source
MassApplyPatch.pr_statusesMethod
pr_statuses(prs::AbstractVector{<:AbstractString})

Return a Vector{String} of PR statuses in the same order as prs.

Accepted PR formats:

  • "https://github.com/OWNER/REPO/pull/123"
  • "OWNER/REPO#123"

Statuses are "draft" (when draft), otherwise "open" or "closed".

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

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
MassApplyPatch.reopen_issue!Method
reopen_issue!(issue; comment=nothing, ignore_errors=true)

Reopen a GitHub issue or pull request using the gh CLI.

issue may be an issue/PR URL like:

  • https://github.com/ORG/REPO/issues/123
  • https://github.com/ORG/REPO/pull/123 or any identifier accepted by gh issue reopen / gh pr reopen.

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

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

source
MassApplyPatch.trigger_workflow_dispatch!Method
trigger_workflow_dispatch!(
  repos::AbstractVector{<:AbstractString},
  workflow::AbstractString;
  ref::Union{Nothing, AbstractString}=nothing,
  inputs::AbstractDict=Dict{String, String}(),
  api::GitHub.GitHubAPI=GitHub.DEFAULT_API,
)

Trigger a GitHub Actions workflow dispatch for each repository in repos.

  • repos should contain entries like "OWNER/REPO".
  • workflow can be a workflow file name (for example "TagBot.yml"), workflow name, or workflow ID.
  • If ref is nothing, each repository's default branch is used.
  • inputs are optional workflow_dispatch inputs.

Returns:

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

source