Skip to content

Commit 0632250

Browse files
add requirement and detection that breaking changes are explained in release notes
1 parent 11d89a1 commit 0632250

File tree

2 files changed

+51
-0
lines changed

2 files changed

+51
-0
lines changed

docs/src/guidelines.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,28 @@ very possible for a perfectly good name to not pass the automatic checks and
130130
require manual merging. They simply exist to provide a fast path so that
131131
manual review is not required for every new package.
132132

133+
### Providing and updating release notes
134+
135+
When invoking a registration with the `@JuliaRegister` bot, release notes can be added in the form
136+
```
137+
@JuliaRegistrator register
138+
139+
Release notes:
140+
141+
## Breaking changes
142+
143+
- Explanation of breaking change, ideally with upgrade tips
144+
- ...
145+
```
146+
147+
These can also be added/updated on the General PR by re-invoking with the above.
148+
149+
Doing this has two benefits:
150+
- helps explanations during the registration process, especially for breaking changes
151+
- release notes are picked up by TagBot such that they are added to the new release on the orignial repo
152+
153+
Automerge is disabled for breaking changes where release notes are not provided mentioning "breaking".
154+
133155
## List of all GitHub PR labels that can influence AutoMerge
134156

135157
AutoMerge reads certain labels on GitHub registration pull requests to influence its decisions.

src/AutoMerge/guidelines.jl

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,33 @@ function meets_name_match_check(
322322
return (true, "")
323323
end
324324

325+
# This check checks for an explanation of why a breaking change is breaking
326+
const guideline_breaking_explanation = Guideline(;
327+
info = "Release notes have not been provided that explain why this is a breaking change.",
328+
docs = "If this is a breaking change, release notes must be given that explain why this is a breaking change (i.e. mention \"breaking\"). To update the release notes, please see the \"Providing and updating release notes\" subsection under \"Additional information\" below.",
329+
check=data -> meets_breaking_explanation_check(data.pr.labels, data.pr.body))
330+
331+
function meets_breaking_explanation_check(labels, body)
332+
# We only need to check the release notes for breaking changes
333+
if any(==("BREAKING"), labels)
334+
release_notes = get_release_notes(body)
335+
if release_notes === nothing
336+
return false, "This is a breaking change, but no release notes have been provided."
337+
elseif !occursin(r"breaking", lowercase(release_notes))
338+
return false, "This is a breaking change, but the release notes do not mention it."
339+
else
340+
return true, ""
341+
end
342+
else
343+
return true, ""
344+
end
345+
end
346+
347+
function get_release_notes(body::AbstractString)
348+
pattern = r"<!-- BEGIN RELEASE NOTES -->\s*(.*?)\s*<!-- END RELEASE NOTES -->"
349+
return findfirst(pattern, body)
350+
end
351+
325352

326353
# This check looks for similar (but not exactly matching) names. It can be
327354
# overridden by a label.
@@ -1078,6 +1105,7 @@ function get_automerge_guidelines(
10781105
this_is_jll_package::Bool,
10791106
this_pr_can_use_special_jll_exceptions::Bool,
10801107
use_distance_check::Bool,
1108+
use_breaking_explanation_check::Bool = !this_is_jll_package,
10811109
package_author_approved::Bool # currently unused for new packages
10821110
)
10831111
guidelines = [
@@ -1111,6 +1139,7 @@ function get_automerge_guidelines(
11111139
(guideline_dependency_confusion, true),
11121140
# this is the non-optional part of name checking
11131141
(guideline_name_match_check, true),
1142+
(guideline_breaking_explanation, use_breaking_explanation_check),
11141143
# We always run the `guideline_distance_check`
11151144
# check last, because if the check fails, it
11161145
# prints the list of similar package names in

0 commit comments

Comments
 (0)