Internals
RegistryCI.test
— Functiontest(path)
Run various checks on the registry located at path
. Checks for example that all files are parsable and understandable by Pkg and consistency between Registry.toml and each Package.toml.
If your registry has packages that have dependencies that are registered in other registries elsewhere, then you may provide the github urls for those registries using the registry_deps
parameter.
RegistryCI.AutoMerge.get_all_non_jll_package_names
— Methodget_all_non_jll_package_names(registry_dir::AbstractString) -> Vector{String}
get_all_non_jll_package_names(registry::RegistryInstance) -> Vector{String}
Given either:
- a path to a directory holding an uncompressed registry
or
- a
RegistryInstance
object (from RegistryInstances.jl) associated to a registry,
returns a sorted list of the names of Julia's standard libraries and all the non-JLL packages defined in that registry.
RegistryCI.AutoMerge.load_files_from_url_and_tree_hash
— Methodload_files_from_url_and_tree_hash(f, destination::String, url::String, tree_hash::String) -> Bool
Attempts to clone a git repo from url
into a temporary directory, runs f(dir)
on that directory, then extract the files and folders from a given tree_hash
, placing them in destination
.
Returns a boolean indicating if the cloning succeeded.
RegistryCI.AutoMerge.maybe_create_blocked_label
— Methodmaybe_create_blocked_label(api, repo)
Add the label AutoMerge: last run blocked by comment
to the repo if it doesn't already exist.
Returns whether or not it created the label.
RegistryCI.AutoMerge.parse_registry_pkg_info
— Functionparse_registry_pkg_info(registry_path, pkg, version=nothing) -> @NamedTuple{uuid::String, repo::String, subdir::String, tree_hash::Union{Nothing, String}}
Searches the registry located at registry_path
for a package with name pkg
. Upon finding it, it parses the associated Package.toml
file and returns the UUID and repository URI, and subdir
.
If version
is supplied, then the associated tree_hash
will be returned. Otherwise, tree_hash
will be nothing
.
RegistryCI.AutoMerge.run
— Methodrun([env, cicfg::CIService]; kwargs...)
Run the RegistryCI.AutoMerge
service.
Arguments
env
: anAbstractDictionary
used to read environmental variables from. Defaults toENV
but a plainDict
can be passed to mimic an alternate environment.ciccfg
: Configuration struct describing the continuous integration (CI) environment in which AutoMerge is being run.
Keyword Arguments
merge_new_packages
: should AutoMerge merge registration PRs for new packagesmerge_new_versions
: should AutoMerge merge registration PRs for new versions of packagesnew_package_waiting_period
: new package waiting period, e.gDay(3)
.new_jll_package_waiting_period
: new JLL package waiting period, e.gMinute(20)
.new_version_waiting_period
: new package version waiting period, e.gMinute(10)
.new_jll_version_waiting_period
: new JLL package version waiting period, e.gMinute(10)
.registry
: the registry name you want to run AutoMerge on.tagbot_enabled
: if tagbot is enabled.authorized_authors
: list of who can submit registration, e.gString["JuliaRegistrator"]
.authorized_authors_special_jll_exceptions
: a list of users who can submit JLL packages (which have strict rules about allowed dependencies and are subject tonew_jll_*_waiting_period
s instead ofnew_*_waiting_period
s).additional_statuses
: list of additional commit statuses that must pass before AutoMerge will merge a PRadditional_check_runs
: list of additional check runs that must pass before AutoMerge will merge a PRerror_exit_if_automerge_not_applicable
: iffalse
, AutoMerge will not error on PRs made by non-AutoMerge-authorized usersmaster_branch
: name ofmaster_branch
, e.g you may want to specify this to"main"
for new GitHub repositories.master_branch_is_default_branch
: ifmaster_branch
specified above is the default branch.suggest_onepointzero
: should the AutoMerge comment include a suggestion to tag a 1.0 release for v0.x.y packages.point_to_slack
: should the AutoMerge comment recommend sending a message to the#pkg-registration
Julia-Slack channel when auto-merging is not possible.registry_deps
: list of registry dependencies, e.g your packages may depend onGeneral
.api_url
: the registry host API URL, default is"https://api.github.com"
.check_license
: check package has a valid license, default isfalse
.public_registries
: If a new package registration has a UUID that matches that of a package already registered in one of these registries supplied here (and has either a different name or different URL) then an error will be thrown. This to prevent AutoMerge from being used for "dependency confusion" attacks on those registries.read_only
: run in read only mode, default isfalse
.
Example
Here is an example of how General
registry is configured
using RegistryCI
using Dates
RegistryCI.AutoMerge.run(
merge_new_packages = ENV["MERGE_NEW_PACKAGES"] == "true",
merge_new_versions = ENV["MERGE_NEW_VERSIONS"] == "true",
new_package_waiting_period = Day(3),
new_jll_package_waiting_period = Minute(20),
new_version_waiting_period = Minute(10),
new_jll_version_waiting_period = Minute(10),
registry = "JuliaLang/General",
tagbot_enabled = true,
authorized_authors = String["JuliaRegistrator"],
authorized_authors_special_jll_exceptions = String["jlbuild"],
suggest_onepointzero = false,
point_to_slack = false,
additional_statuses = String[],
additional_check_runs = String[],
check_license = true,
public_registries = String["https://github.com/HolyLab/HolyLabRegistry"],
)
RegistryCI.AutoMerge.try_remove_label
— Methodtry_remove_label(api, repo, issue, label)
Uses GitHub.remove_label
to remove the label, if it exists. Differs from the upstream functionality by not erroring if we receive a 404 response indicating the label did not exist.
Returns whether or not the label was removed.