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

Generate changelog both as RST and MarkDown #576

Merged
merged 9 commits into from
Feb 13, 2024

Conversation

felixfontein
Copy link
Collaborator

@felixfontein felixfontein commented Feb 3, 2024

This needs ansible-community/antsibull-changelog#139 to actually work. CI will horribly fail since I didn't adjust it to use that repo/branch :-) This now uses the latest antsibull-changelog 0.24.0 release, which includes MarkDown support.

@felixfontein felixfontein changed the title [WIP] Generate changelog both as RST and MarkDown Generate changelog both as RST and MarkDown Feb 9, 2024
@felixfontein felixfontein marked this pull request as ready for review February 9, 2024 21:24
@felixfontein
Copy link
Collaborator Author

felixfontein commented Feb 9, 2024

This is now fully ready for review! 🎉

I guess we have to decide on two points:

  1. Do we want a MD changelog at all? (I would say yes.)
  2. Do we want the MD changelog to be the main changelog (that's referenced from the porting guides and the announcements)? (I would also say yes, considering GitHub's current screw-up with RST rendering.)

Also: do we just decide this (especially 2), or do we need to discuss this with the whole of SC (I guess I just answered this one myself, see below :) ), or even vote on it?

@felixfontein
Copy link
Collaborator Author

Dear @ansible-community/steering-committee, since you might have noticed that GitHub introduced a change that breaks rendering many RST files (https://github.com/orgs/community/discussions/86715), including the ansible-core and Ansible changelog, I've started implementing code to render the changelogs as MarkDown. The result for the Ansible changelog can be seen here: ansible-community/ansible-build-data#364

What do you think about the above questions? I.e., do we want the Ansible package to have the changelog both as RST and MarkDown? (I would include both: the MD version so users can see a rendered one on GitHub, and the RST version for backwards compatibility.) And which version do we want to link to in release announcements and from the porting guide?

(There's also the related discussion whether we want to include the changelog in the docsite or something like that, but please let's not discuss that here and now.)

@briantist
Copy link
Contributor

briantist commented Feb 9, 2024

I would also suggest both, mostly becuase of

discussion whether we want to include the changelog in the docsite or something like that

But I'll refrain from saying more as requested.
I definitely think the addition of MD is useful for direct viewing in GitHub too.

@Andersson007
Copy link
Contributor

MD looks good to me

@felixfontein
Copy link
Collaborator Author

If nobody objects I'll merge this tomorrow, and then also refresh (if necessary) and merge ansible-community/ansible-build-data#364.

builder.add_raw_rst("")
section = renderer.add_section("Release Summary")
section.add_text(
t.cast(str, release_summary), text_format=TextFormat.RESTRUCTURED_TEXT
Copy link
Contributor

Choose a reason for hiding this comment

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

If you annotate the declaration of release_summary with release_summary: str | None you should be able to get rid of the cast, but I guess it was there before.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

That results in mypy complaining:

src/antsibull/build_changelog.py:297: error: Incompatible types in assignment (expression has type "str | list[str] | None", variable has type "str | None")  [assignment]

src/antsibull/build_changelog.py Outdated Show resolved Hide resolved
src/antsibull/build_changelog.py Outdated Show resolved Hide resolved
"If not mentioned explicitly, the changes are reported in the combined changelog"
" below.\n"
" below.",
text_format=TextFormat.RESTRUCTURED_TEXT,
Copy link
Contributor

Choose a reason for hiding this comment

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

Why isn't this

Suggested change
text_format=TextFormat.RESTRUCTURED_TEXT,
text_format=text_format,

?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

For this piece of text it doesn't really matter, but generally I either want to use something like TextFormat.PLAINTEXT (which isn't supported yet) or specify another explicit format which definitely matches (in this case, TextFormat.RESTRUCTURED_TEXT) to avoid potential problems with conflicting markup in other formats added in the future.

@felixfontein felixfontein mentioned this pull request Feb 13, 2024
Copy link

@oraNod oraNod left a comment

Choose a reason for hiding this comment

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

Thanks for this @felixfontein I've given this a review mostly just by looking at the code and trying to understand what it's doing and it seems fine. I had some questions about pandoc but you answered those as well. I'm sure more experienced pythonistas might have nits or other comments but in general looks really good and is a cool solution for the changelog rendering issue. 🎉

@felixfontein felixfontein merged commit 77b9e1c into ansible-community:main Feb 13, 2024
9 checks passed
@felixfontein
Copy link
Collaborator Author

@briantist @Andersson007 @gotmax23 @oraNod thanks a lot for your reviews and comments!

@felixfontein felixfontein deleted the markdown branch February 13, 2024 12:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants