diff --git a/docs/src/index.md b/docs/src/index.md index 0e4d6617..4a105e47 100644 --- a/docs/src/index.md +++ b/docs/src/index.md @@ -8,7 +8,7 @@ Modules = [CompatHelper] # [CompatHelper.jl](https://github.com/JuliaRegistries/CompatHelper.jl) -CompatHelper is a Julia package that helps you keep your `[compat]` entries up-to-date. +CompatHelper is a Julia package that helps you keep your `[compat]` entries up-to-date in your `Project.toml`, `docs/Project.toml`, and `test/Project.toml` (if they exist). Whenever one of your package's dependencies releases a new breaking version, CompatHelper opens a pull request on your repository that modifies your `[compat]` entry to reflect the newly released version. We would like to eventually add Julia support to [Dependabot](https://dependabot.com). If you would like to help with adding Julia support to Dependabot, join us in the `#dependabot` channel on the [Julia Language Slack](https://julialang.org/slack/). diff --git a/src/main.jl b/src/main.jl index 98b103fe..3d406225 100644 --- a/src/main.jl +++ b/src/main.jl @@ -35,7 +35,8 @@ Main entry point for the package. - `include_jll::Bool=false`: Include JLL packages to bump - `unsub_from_prs=false`: Unsubscribe the user from the pull requests - `cc_user=false`: CC the user on the pull requests -- `bump_version=false`: When set to true, the version in Project.toml will be bumped if a pull request is made. Minor bump if >= 1.0, or patch bump if < 1.0 +- `bump_version=false`: When set to true, the version in Project.toml will be bumped if a pull request to the main Project.toml of the package is made. + Minor bump if >= 1.0, or patch bump if < 1.0 - `include_yanked=false`: When set to true, yanked versions will be included when calculating what the latest version of a package is """ function main( @@ -50,29 +51,37 @@ function main( local_clone_path = get_local_clone(api, ci_cfg, repo; options) for subdir in options.subdirs - project_file = @mock joinpath(local_clone_path, subdir, "Project.toml") - deps = get_project_deps(project_file; include_jll=options.include_jll) + for project in ["", "docs", "test"] + is_main_project = project == "" + subdir = joinpath(subdir, project) + project_file = @mock joinpath(local_clone_path, subdir, "Project.toml") + if !isfile(project_file) && !is_main_project + continue + end + deps = get_project_deps(project_file; include_jll=options.include_jll) - if options.use_existing_registries - get_existing_registries!(deps, options.depot; options) - else - get_latest_version_from_registries!(deps, options.registries; options) - end + if options.use_existing_registries + get_existing_registries!(deps, options.depot; options) + else + get_latest_version_from_registries!(deps, options.registries; options) + end - for dep in deps - pr = @mock make_pr_for_new_version( - api, - repo, - dep, - options.entry_type, - ci_cfg; - options, - subdir, - local_clone_path, - ) + for dep in deps + pr = @mock make_pr_for_new_version( + api, + repo, + dep, + options.entry_type, + ci_cfg; + options, + subdir, + local_clone_path, + is_main_project + ) - if !isnothing(pr) - push!(generated_prs, pr) + if !isnothing(pr) + push!(generated_prs, pr) + end end end end diff --git a/src/utilities/new_versions.jl b/src/utilities/new_versions.jl index 1f12fddd..03450853 100644 --- a/src/utilities/new_versions.jl +++ b/src/utilities/new_versions.jl @@ -209,11 +209,17 @@ function make_pr_for_new_version( options::Options, subdir::String, local_clone_path::AbstractString, + is_main_project::Bool=true ) if !continue_with_pr(dep, options.bump_compat_containing_equality_specifier) return nothing end + # Don't create new compat entries in docs/ and test/, only update existing ones + if isnothing(dep.version_verbatim) && !is_main_project + return nothing + end + # Get new compat entry version, pr title, and pr body text compat_entry_for_latest_version = compat_version_number(dep.latest_version) brand_new_compat = new_compat_entry( @@ -268,7 +274,7 @@ function make_pr_for_new_version( dep.package.name, joinpath(local_clone_path, subdir), brand_new_compat, - options.bump_version, + options.bump_version && is_main_project, ) git_add()