Skip to content

Commit

Permalink
Tweak AutoMerge comment formatting and wording (#564)
Browse files Browse the repository at this point in the history
* remove introduction section header

* make section titles smaller

* rm dead code

* tweak comment text

* bump version

* revert paragraph break in intro

* Revert "make section titles smaller"

This reverts commit 7dbd368.
  • Loading branch information
ericphanson committed Jun 15, 2024
1 parent e4bb3ad commit acad532
Show file tree
Hide file tree
Showing 35 changed files with 324 additions and 340 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "RegistryCI"
uuid = "0c95cc5f-2f7e-43fe-82dd-79dbcba86b32"
authors = ["Dilum Aluthge <[email protected]>", "Fredrik Ekre <[email protected]>", "contributors"]
version = "10.3.1"
version = "10.4.0"

[deps]
Base64 = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f"
Expand Down
2 changes: 0 additions & 2 deletions src/AutoMerge/cron.jl
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,6 @@ function cron_or_api_build(
if pr_type == :NewPackage # it is a new package
always_assert(status_pr_type == :NewPackage)
if merge_new_packages
my_comment = comment_text_merge_now()
@info(
string(
"Pull request: $(pr_number). ",
Expand Down Expand Up @@ -434,7 +433,6 @@ function cron_or_api_build(
always_assert(pr_type == :NewVersion)
always_assert(status_pr_type == :NewVersion)
if merge_new_versions
my_comment = comment_text_merge_now()
@info(
string(
"Pull request: $(pr_number). ",
Expand Down
82 changes: 34 additions & 48 deletions src/AutoMerge/util.jl
Original file line number Diff line number Diff line change
Expand Up @@ -96,35 +96,31 @@ end
# We hope they will at least read the section titles, and if they aren't
# familiar, hopefully they will also read the sections themselves.

function _comment_bot_intro(n)
return string("## $n. Introduction\n\n", "Hello, I am an automated registration bot.",
function _comment_bot_intro()
return string("Hello, I am an automated registration bot.",
" I help manage the registration process by checking your registration against a set of ","[AutoMerge guidelines](https://juliaregistries.github.io/RegistryCI.jl/stable/guidelines/). ",
"Meeting these guidelines is only required for the pull request to be **merged automatically**. ",
"However, it is **strongly recommended** to follow them, since otherwise ",
"If all these guidelines are met, this pull request will be merged automatically, completing your registration. It is **strongly recommended** to follow the guidelines, since otherwise ",
"the pull request needs to be manually reviewed and merged by a human.\n\n")
end

function _new_package_section(n)
return string("## $n. New package registration", "\n\n",
"Since you are registering a new package, please make sure that you have read the ",
"Please make sure that you have read the ",
"[package naming guidelines](https://julialang.github.io/Pkg.jl/dev/creating-packages/#Package-naming-guidelines-1).\n\n")
end

function _what_next_if_fail(n; point_to_slack=false)
msg = """
## $n. *Needs action*: here's what to do next
1. Please try to update your package to conform to these guidelines. The [General registry's README](https://github.com/JuliaRegistries/General/blob/master/README.md) has an FAQ that can help figure out how to do so. You can also leave a comment on this PR (and include `[noblock]`)"""
if point_to_slack
msg = string(msg, " or send a message to the `#pkg-registration` channel in the [public Julia Slack](https://julialang.org/slack/) to ask for help. Include a link to this pull request if you do so!")
end
1. Please try to update your package to conform to these guidelines. The [General registry's README](https://github.com/JuliaRegistries/General/blob/master/README.md) has an FAQ that can help figure out how to do so."""
msg = string(msg, "\n",
"2. After you have fixed the AutoMerge issues, simply retrigger Registrator, the same way you did in the initial registration. This will automatically update this pull request. You do not need to change the version number in your `Project.toml` file (unless of course the AutoMerge issue is that you skipped a version number, in which case you should change the version number).",
"2. After you have fixed the AutoMerge issues, simply retrigger Registrator, the same way you did in the initial registration. This will automatically update this pull request. You do not need to change the version number in your `Project.toml` file (unless the AutoMerge issue is that you skipped a version number).",
"\n\n",
"If you do not want to fix the AutoMerge issues, please post a comment explaining why you would like this pull request to be manually merged.")
"If you need help fixing the AutoMerge issues, or want your pull request to be manually merged instead, please post a comment explaining what you need help with or why you would like this pull request to be manually merged.")

if point_to_slack
msg = string(msg, " Then, send a message to the `#pkg-registration` channel in the [public Julia Slack](https://julialang.org/slack/) to ask for help.")
msg = string(msg, " Then, send a message to the `#pkg-registration` channel in the [public Julia Slack](https://julialang.org/slack/) for better visibility.")
end
msg = string(msg, "\n\n")
return msg
Expand All @@ -146,8 +142,8 @@ function _comment_noblock(n)
"If you want to post a comment without blocking ",
"auto-merging, you must include the text ",
"`[noblock]` in your comment. ",
"You can edit blocking comments, adding `[noblock]` ",
"to them in order to unblock auto-merging.\n\n",
"\n\n_Tip: You can edit blocking comments to add `[noblock]` ",
"in order to unblock auto-merging._\n\n",
)
return result
end
Expand All @@ -158,13 +154,13 @@ function comment_text_pass(
# Need to know this ahead of time to get the section numbers right
suggest_onepointzero &= version < v"1.0.0"
result = string(
_comment_bot_intro(1),
_automerge_guidelines_passed_section_title(2),
_comment_bot_intro(),
_automerge_guidelines_passed_section_title(1),
"Your new version registration met all of the ",
"guidelines for auto-merging and is scheduled to ",
"be merged in the next round.\n\n",
_onepointzero_suggestion(3, suggest_onepointzero, version),
_comment_noblock(suggest_onepointzero ? 4 : 3),
_onepointzero_suggestion(2, suggest_onepointzero, version),
_comment_noblock(suggest_onepointzero ? 3 : 2),
"<!-- [noblock] -->",
)
return result
Expand All @@ -176,25 +172,25 @@ function comment_text_pass(
suggest_onepointzero &= version < v"1.0.0"
if is_jll
result = string(
_comment_bot_intro(1),
_automerge_guidelines_passed_section_title(2),
_comment_bot_intro(),
_automerge_guidelines_passed_section_title(1),
"Your new `_jll` package registration met all of the ",
"guidelines for auto-merging and is scheduled to ",
"be merged in the next round.\n\n",
_onepointzero_suggestion(3, suggest_onepointzero, version),
_comment_noblock(suggest_onepointzero ? 4 : 3),
_onepointzero_suggestion(2, suggest_onepointzero, version),
_comment_noblock(suggest_onepointzero ? 3 : 2),
"<!-- [noblock] -->",
)
else
result = string(
_comment_bot_intro(1),
_new_package_section(2),
_automerge_guidelines_passed_section_title(3),
_comment_bot_intro(),
_new_package_section(1),
_automerge_guidelines_passed_section_title(2),
"Your new package registration met all of the ",
"guidelines for auto-merging and is scheduled to ",
"be merged when the mandatory waiting period ($new_package_waiting_period) has elapsed.\n\n",
_onepointzero_suggestion(4, suggest_onepointzero, version),
_comment_noblock(suggest_onepointzero ? 5 : 4),
_onepointzero_suggestion(3, suggest_onepointzero, version),
_comment_noblock(suggest_onepointzero ? 4 : 3),
"<!-- [noblock] -->",
)
end
Expand All @@ -211,13 +207,13 @@ function comment_text_fail(
suggest_onepointzero &= version < v"1.0.0"
reasons_formatted = string(join(string.("- ", reasons), "\n"), "\n\n")
result = string(
_comment_bot_intro(1),
_new_package_section(2),
_automerge_guidelines_failed_section_title(3),
_comment_bot_intro(),
_new_package_section(1),
_automerge_guidelines_failed_section_title(2),
reasons_formatted,
_what_next_if_fail(4; point_to_slack=point_to_slack),
_onepointzero_suggestion(5, suggest_onepointzero, version),
_comment_noblock(suggest_onepointzero ? 6 : 5),
_what_next_if_fail(3; point_to_slack=point_to_slack),
_onepointzero_suggestion(4, suggest_onepointzero, version),
_comment_noblock(suggest_onepointzero ? 5 : 4),
"<!-- [noblock] -->",
)
return result
Expand All @@ -233,27 +229,17 @@ function comment_text_fail(
suggest_onepointzero &= version < v"1.0.0"
reasons_formatted = string(join(string.("- ", reasons), "\n"), "\n\n")
result = string(
_comment_bot_intro(1),
_automerge_guidelines_failed_section_title(2),
_comment_bot_intro(),
_automerge_guidelines_failed_section_title(1),
reasons_formatted,
_what_next_if_fail(3; point_to_slack=point_to_slack),
_onepointzero_suggestion(4, suggest_onepointzero, version),
_comment_noblock(suggest_onepointzero ? 5 : 4),
_what_next_if_fail(2; point_to_slack=point_to_slack),
_onepointzero_suggestion(3, suggest_onepointzero, version),
_comment_noblock(suggest_onepointzero ? 4 : 3),
"<!-- [noblock] -->",
)
return result
end

function comment_text_merge_now()
result = string(
"The mandatory waiting period has elapsed.\n\n",
"Your pull request is ready to merge.\n\n",
"I will now merge this pull request.",
"\n<!-- [noblock] -->",
)
return result
end

is_julia_stdlib(name) = name in julia_stdlib_list()

function julia_stdlib_list()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
## 1. Introduction
Hello, I am an automated registration bot. I help manage the registration process by checking your registration against a set of [AutoMerge guidelines](https://juliaregistries.github.io/RegistryCI.jl/stable/guidelines/). If all these guidelines are met, this pull request will be merged automatically, completing your registration. It is **strongly recommended** to follow the guidelines, since otherwise the pull request needs to be manually reviewed and merged by a human.

Hello, I am an automated registration bot. I help manage the registration process by checking your registration against a set of [AutoMerge guidelines](https://juliaregistries.github.io/RegistryCI.jl/stable/guidelines/). Meeting these guidelines is only required for the pull request to be **merged automatically**. However, it is **strongly recommended** to follow them, since otherwise the pull request needs to be manually reviewed and merged by a human.
## 1. New package registration

## 2. New package registration
Please make sure that you have read the [package naming guidelines](https://julialang.github.io/Pkg.jl/dev/creating-packages/#Package-naming-guidelines-1).

Since you are registering a new package, please make sure that you have read the [package naming guidelines](https://julialang.github.io/Pkg.jl/dev/creating-packages/#Package-naming-guidelines-1).

## 3. [AutoMerge Guidelines](https://juliaregistries.github.io/RegistryCI.jl/stable/guidelines/) which are not met ❌
## 2. [AutoMerge Guidelines](https://juliaregistries.github.io/RegistryCI.jl/stable/guidelines/) which are not met ❌

- Example guideline failed. Please fix it.

## 4. *Needs action*: here's what to do next
## 3. *Needs action*: here's what to do next

1. Please try to update your package to conform to these guidelines. The [General registry's README](https://github.com/JuliaRegistries/General/blob/master/README.md) has an FAQ that can help figure out how to do so.
2. After you have fixed the AutoMerge issues, simply retrigger Registrator, the same way you did in the initial registration. This will automatically update this pull request. You do not need to change the version number in your `Project.toml` file (unless the AutoMerge issue is that you skipped a version number).

1. Please try to update your package to conform to these guidelines. The [General registry's README](https://github.com/JuliaRegistries/General/blob/master/README.md) has an FAQ that can help figure out how to do so. You can also leave a comment on this PR (and include `[noblock]`)
2. After you have fixed the AutoMerge issues, simply retrigger Registrator, the same way you did in the initial registration. This will automatically update this pull request. You do not need to change the version number in your `Project.toml` file (unless of course the AutoMerge issue is that you skipped a version number, in which case you should change the version number).
If you need help fixing the AutoMerge issues, or want your pull request to be manually merged instead, please post a comment explaining what you need help with or why you would like this pull request to be manually merged.

If you do not want to fix the AutoMerge issues, please post a comment explaining why you would like this pull request to be manually merged.
## 4. To pause or stop registration

## 5. To pause or stop registration
If you want to prevent this pull request from being auto-merged, simply leave a comment. If you want to post a comment without blocking auto-merging, you must include the text `[noblock]` in your comment.

If you want to prevent this pull request from being auto-merged, simply leave a comment. If you want to post a comment without blocking auto-merging, you must include the text `[noblock]` in your comment. You can edit blocking comments, adding `[noblock]` to them in order to unblock auto-merging.
_Tip: You can edit blocking comments to add `[noblock]` in order to unblock auto-merging._

<!-- [noblock] -->
<!-- [noblock] -->
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
## 1. Introduction
Hello, I am an automated registration bot. I help manage the registration process by checking your registration against a set of [AutoMerge guidelines](https://juliaregistries.github.io/RegistryCI.jl/stable/guidelines/). If all these guidelines are met, this pull request will be merged automatically, completing your registration. It is **strongly recommended** to follow the guidelines, since otherwise the pull request needs to be manually reviewed and merged by a human.

Hello, I am an automated registration bot. I help manage the registration process by checking your registration against a set of [AutoMerge guidelines](https://juliaregistries.github.io/RegistryCI.jl/stable/guidelines/). Meeting these guidelines is only required for the pull request to be **merged automatically**. However, it is **strongly recommended** to follow them, since otherwise the pull request needs to be manually reviewed and merged by a human.
## 1. New package registration

## 2. New package registration
Please make sure that you have read the [package naming guidelines](https://julialang.github.io/Pkg.jl/dev/creating-packages/#Package-naming-guidelines-1).

Since you are registering a new package, please make sure that you have read the [package naming guidelines](https://julialang.github.io/Pkg.jl/dev/creating-packages/#Package-naming-guidelines-1).

## 3. [AutoMerge Guidelines](https://juliaregistries.github.io/RegistryCI.jl/stable/guidelines/) which are not met ❌
## 2. [AutoMerge Guidelines](https://juliaregistries.github.io/RegistryCI.jl/stable/guidelines/) which are not met ❌

- Example guideline failed. Please fix it.

## 4. *Needs action*: here's what to do next
## 3. *Needs action*: here's what to do next

1. Please try to update your package to conform to these guidelines. The [General registry's README](https://github.com/JuliaRegistries/General/blob/master/README.md) has an FAQ that can help figure out how to do so.
2. After you have fixed the AutoMerge issues, simply retrigger Registrator, the same way you did in the initial registration. This will automatically update this pull request. You do not need to change the version number in your `Project.toml` file (unless the AutoMerge issue is that you skipped a version number).

1. Please try to update your package to conform to these guidelines. The [General registry's README](https://github.com/JuliaRegistries/General/blob/master/README.md) has an FAQ that can help figure out how to do so. You can also leave a comment on this PR (and include `[noblock]`) or send a message to the `#pkg-registration` channel in the [public Julia Slack](https://julialang.org/slack/) to ask for help. Include a link to this pull request if you do so!
2. After you have fixed the AutoMerge issues, simply retrigger Registrator, the same way you did in the initial registration. This will automatically update this pull request. You do not need to change the version number in your `Project.toml` file (unless of course the AutoMerge issue is that you skipped a version number, in which case you should change the version number).
If you need help fixing the AutoMerge issues, or want your pull request to be manually merged instead, please post a comment explaining what you need help with or why you would like this pull request to be manually merged. Then, send a message to the `#pkg-registration` channel in the [public Julia Slack](https://julialang.org/slack/) for better visibility.

If you do not want to fix the AutoMerge issues, please post a comment explaining why you would like this pull request to be manually merged. Then, send a message to the `#pkg-registration` channel in the [public Julia Slack](https://julialang.org/slack/) to ask for help.
## 4. To pause or stop registration

## 5. To pause or stop registration
If you want to prevent this pull request from being auto-merged, simply leave a comment. If you want to post a comment without blocking auto-merging, you must include the text `[noblock]` in your comment.

If you want to prevent this pull request from being auto-merged, simply leave a comment. If you want to post a comment without blocking auto-merging, you must include the text `[noblock]` in your comment. You can edit blocking comments, adding `[noblock]` to them in order to unblock auto-merging.
_Tip: You can edit blocking comments to add `[noblock]` in order to unblock auto-merging._

<!-- [noblock] -->
Loading

2 comments on commit acad532

@ericphanson
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/109075

Tip: Release Notes

Did you know you can add release notes too? Just add markdown formatted text underneath the comment after the text
"Release notes:" and it will be added to the registry PR, and if TagBot is installed it will also be added to the
release that TagBot creates. i.e.

@JuliaRegistrator register

Release notes:

## Breaking changes

- blah

To add them here just re-invoke and the PR will be updated.

Tagging

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v10.4.0 -m "<description of version>" acad5329d9ea46f3984f9c600a3cf5f960347c5f
git push origin v10.4.0

Please sign in to comment.