-
Notifications
You must be signed in to change notification settings - Fork 162
Changelog script: multiple changelog entries for a single PR #5279
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
base: master
Are you sure you want to change the base?
Conversation
0d7ed72 to
c40d3ae
Compare
|
I'll review this PR once PR #5271 has been merged and this one has been rebased, as then it's much easier to see what the additional changes in here are. |
|
Does this also allow to specify two levels of labels for each entry? This should also be added to https://docs.oscar-system.org/dev/DeveloperDocumentation/changelog/. Please talk about how to use this with Martin before merging (no need to ping them at this point though) as they are one of the few people using this already extensively. Thus it would be good to get their feedback on usability. |
Implementation wise, it replaces the original PR with multiple PRs in the PR list, with the only difference being different topics are added to these "child" PRs. So, it should retain any secondary tags which were in the original PR, and the two level changelog should still work, although I have not tested this (yet). |
|
Conflicts need to be resolved now. And of course happy to discuss with @HereAround . Note that this implements my proposal from #4673 and I hope people are already aware of that... |
c40d3ae to
c609105
Compare
|
What is the state of this? It would be really great if we could have this in a few weeks before the next release, so that people can already learn about this and start using it (thus reducing the manual amount of work needed for the release). |
|
This is on my list right after the documenter business (which I am working on now). I hope to be able to get this done by next Wednesday (05 nov) |
Previously , we did something really stupid and did half the work in two places.
|
Now converts the body into |
This reverts commit e78c6e5.
|
|
|
|
||
| #### Release Notes: Use Body | ||
|
|
||
| It is possible to manually supply release notes in the body of the PR (the first |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe the "body" is usually called "description"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The API calls it "body". I can change it to "description" if that is more widely understood as "first comment of the PR"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am fine with using "body" as long as this term is used consistently. We can simply explain it better and even link it to the term "description". For example:
(the body of the PR is the first comment in the PR, created at the same time as the PR is created; it is also sometimes call the "description" of the PR).
| #### Release Notes: Use Body | ||
|
|
||
| It is possible to manually supply release notes in the body of the PR (the first | ||
| comment in the PR). To do this, make a section in your PR title by putting a |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR title?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be whatever is the first part called (body, or description, whatever the consensus is)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wee it definitely shouldn't be "title", because that's simply wrong.
| comment in the PR). To do this, make a section in your PR title by putting a | |
| comment in the PR). To do this, make a section in your PR body by putting a |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, calling it title was a mistake. But I don't want to change it before we have a decision for whether to call it 'body', or, whether to call it 'description'. (or, there is potential for a change, and then another change, if we pick the incorrect alternative the first time)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The label already uses body, the API uses body, and my code change suggestions here everywhere use body, so we're using body :-)
| - item1 {label1, label2} | ||
| - item2 {label3, label4, label5} | ||
| - item3 {label5} | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the empty line here required? If yes, please mention that. If not, can we remove it in all examples?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Strictly speaking, if you have 3 lines ( --- ) right after a line, that is, no empty line, then it is treated as a heading in markdown. It doesn't make a difference in our script, but not leaving that last empty line makes the markdown syntax highlighting color the last line differently, possible confusing someone?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could also simplify this by leaving out the --- bits completely. Just say:
- it starts on a line that is exactly
## Release Notes(I'd be OK with ignoring trailing spaces as those sometimes sneak in and are "invisible"; and I'd also be OK with ignoring case) - then we expects lines starting with
-and of the form- description {label1, label2} - we ignore any empty (except for whitespace) lines before, between or after
- as soon as we hit a line that is neither empty nor starts with
-we stop the scanning.
Then you can properly parse it but without regex, but please also with the current search hack, as follows
- split the body into lines,
rstripeach line (to remove trailing whitespace) - scan the array of line until you find one matching
## Release Notes(ignoring case) - then iterate over the following lines and..
- skip empty ones
- parse those starting with
- - abort the search if you find anything else
That is easy to explain, robust (no weird matches in the middle somewhere) and should be reasonably to use.
|
I don't understand the python code, so I just reviewed the docs change |
|
Changes from current state can be previewed at 06019bf |
dev/releases/release_notes.py
Outdated
| title = pr["title"] | ||
| return f"- [#{k}](https://github.com/oscar-system/Oscar.jl/pull/{k}) {title}\n" | ||
| if has_label(pr, 'release notes: use body'): | ||
| mdstring = pr['body'].replace("- ", f"- [#{k}](https://github.com/oscar-system/Oscar.jl/pull/{k}) ") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Won't this also replace any - that occurs in the middle of a description? Might be better to use a regex anchor, i.e., something like
| mdstring = pr['body'].replace("- ", f"- [#{k}](https://github.com/oscar-system/Oscar.jl/pull/{k}) ") | |
| mdstring = pr['body'].replace(r"^- ", f"- [#{k}](https://github.com/oscar-system/Oscar.jl/pull/{k}) ") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know why, but as of this moment, I am unwilling to use regx. I have tried to make an alternate solution: replace only the first occurrence in string.
I think regx (dash only at first position) might be a stronger solution, but my most recent changes might be enough in this case.
I will change it to regx if you think its better in any case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, there is a concrete bug that can relatively easily occur with your current code, so yeah, I really think you should either use the regex here, or use some other approach that ensures the dash is at the start of a line (e.g. you could also match for "\n- " and replace by "\n- ...")
dev/releases/release_notes.py
Outdated
| return body | ||
| index2 = body.find('---', index1) | ||
| # there are 17 characters from index 1 until the next line | ||
| mdstring = body[index1+17:index2] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But what if there is a line ## release notes follow below instead? Or if the trailing --- is missing? All of these can easily happen by accident.
How about instead using a regex like this (untested, just meant as a rough guide), and then extracting the correcting matching group. (Of course multiline regex matching must be enabled for this, however one does that in Python)
r"^## release notes\n(.+)^---\n"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the same strange reason as above ("gut feeling"), I tried to solve this problem without using regx.
I will change it to the regx solution if you think it is a better solution than my latest commits
|
@aaruni96 I made another comment regarding this at #5544 (comment) |
| # the given label is put into the corresponding section; each PR is put into only one section, the first one | ||
| # one from this list it fits in. | ||
| # See also <https://github.com/gap-system/gap/issues/4257>. | ||
| topics = [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are a bunch of changes in this PR that are independent from the actual purpose of this PR, but each time I look at the python code, I have to filter them out mentally "ah yes I already looked at this, it does XYZ and is fine".
It would really help if that would go into another PR, or at least a separate commit, that only does that refactoring but nothing else.
Specifically
- changing
topicsandprtypesinto dicts - renaming
startdatetotimestamp - dropping an unused
startdateargument - removing a
printstatement
I think that would cut down the diff in half and could be merged right away.
Plus we'd be free to work on renaming the labels as @joschmitt suggested elsewhere in a separate PR (as this PR here would no longer touch the list of topics/prtypes)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, this PR got out of hand.
Would you prefer :
- Splitting out this into 2 PRs, one which just deals with the multiple entries for a single PR, and another which deals with other things
or
- Rewriting some history, to merge all the "patchwork" commits into one commit, and leave the commits which actually tackle the topic at hand separate (I think this might be more involved?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think 1 would be easier
| in the changelog for a single PR. It is possible to label each of the entries | ||
| with their own topic / pr type labels. | ||
|
|
||
| The syntax is the following : |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| The syntax is the following : | |
| The syntax is the following: |
Resolves #4673
Requires #5271
Turns the following body into the even more following changelog entries :