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

Omit changelog header from GitHub release notes #17165

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Marcono1234
Copy link

@Marcono1234 Marcono1234 commented Apr 30, 2024

Resolves #16455

I wasn't sure whether one of you maintainers wanted to implement this, so I gave it a try. Feedback is appreciated! No worries if you reject this pull request (and implement the changes yourself) in case these changes here are not clean enough.

I have tested this using test_data/input.adoc (renamed to 2024-01-01.adoc) with the following command:

cargo run --package xtask --bin xtask publish-release-notes --dry-run xtask/test_data/2024-01-01.adoc

It seems to work correctly, but would be good if you could double check.

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Apr 30, 2024
@Marcono1234 Marcono1234 changed the title Remove changelog header from GitHub release notes Omit changelog header from GitHub release notes Apr 30, 2024
@@ -9,6 +9,22 @@ impl flags::PublishReleaseNotes {
pub(crate) fn run(self, sh: &Shell) -> anyhow::Result<()> {
let asciidoc = sh.read_file(&self.changelog)?;
let mut markdown = notes::convert_asciidoc_to_markdown(std::io::Cursor::new(&asciidoc))?;

// Remove changelog header because GitHub misinterprets the changelog number as issue reference
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
// Remove changelog header because GitHub misinterprets the changelog number as issue reference
// Remove changelog header because it's not going to be relevant for the GitHub release notes

let changelog_header_prefix = "# Changelog #";
let mut changelog_header_start =
markdown.find(changelog_header_prefix).expect("should contain changelog header");
changelog_header_start =
Copy link
Member

Choose a reason for hiding this comment

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

This seems a little too complicated, and I'm not sure why it's needed.

My suggestion is to edit the AsciiDoc source, not the derived Markdown, since the latter is less predictable. That way, we only need to trim off the first line (until the first '\n').

We could also strip off the Commit: ... line because it's redundant, but that seems less important.

Copy link
Author

Choose a reason for hiding this comment

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

Good point; but it seems the AsciiDoc to Markdown conversion currently expects a title, and otherwise fails with "Error: document title not found". And I did not want to remove that code.

So I have changed it now to only remove the # from the changelog number. But since this deviates a bit from what this pull request was originally about, I have marked it as Draft for now again. What do you think?

Copy link
Member

Choose a reason for hiding this comment

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

Sorry, I didn't realize the title was needed for AsciiDoc.

I'd still prefer to strip off the line, since it's useless there.

Copy link
Author

Choose a reason for hiding this comment

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

Maybe the changelog number is a bit useful though? For example when someone refers to it because they read it on the project website. I don't think GitHub itself numbers the releases.

In case you still think the complete title should be removed, should I then also remove the code which tries to convert this AsciiDoc title to Markdown? Or how should I handle the title being required currently?

(Also, in case it is easier for you to directly take this over, just let me know; this PR has "Allow edits by maintainers" enabled in case that is helpful.)

@Marcono1234 Marcono1234 marked this pull request as draft May 3, 2024 21:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

GitHub release changelog number misinterpreted as issue reference
3 participants