Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check docs/Project.toml and test/Project.toml as well #454

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/src/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -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/).
Expand Down
51 changes: 30 additions & 21 deletions src/main.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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
Expand Down
8 changes: 7 additions & 1 deletion src/utilities/new_versions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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()

Expand Down
Loading