Skip to content

Conversation

maiste
Copy link
Collaborator

@maiste maiste commented Sep 29, 2025

This PR is the second part of #12304. It allows us to generate the changelog from the structure in changes/.

It starts by generating the header. Then, the script stacks all the files from the various directories inside the new changelog file. While it is adding the files, it also removes them (we have git, it is easy to revert it). After that, it adds the old changelog without the unnecessary header. Finally, it moves the new changelog to replace the old one.

Requires #12472

Fixes #12304.

@maiste maiste added the chore Something that just needs to be done. label Sep 29, 2025
@maiste maiste requested review from Alizter and shonfeder September 29, 2025 15:50
@shonfeder shonfeder changed the title chore(script): generate changelog from structure" chore(script): generate changelog from structure Oct 2, 2025
Copy link
Collaborator

@shonfeder shonfeder left a comment

Choose a reason for hiding this comment

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

I have a few suggestions here, but none blocking in case you don't like them :)

Comment on lines 49 to 50
list_of_files=$(find "$dir" -maxdepth 1 -type f -not -name ".*")
number_of_files=$(cat $list_of_files | wc -l)
Copy link
Collaborator

Choose a reason for hiding this comment

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

If it finds nothing I think the result here will just be the empty string, in which case there is no need to count the lines, but can instead compare for equality with "".

exit 1
fi

list_of_files=$(find "$dir" -maxdepth 1 -type f -not -name ".*")
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could this just be

Suggested change
list_of_files=$(find "$dir" -maxdepth 1 -type f -not -name ".*")
list_of_files=$(cat "$dir/*.md")

This is arguably more precise, in that if new files types are ever added for some reason they won't be scoped up, and simpler to read, I think.

@maiste maiste force-pushed the chore/changelog-script branch from bdccc06 to fd57aae Compare October 3, 2025 12:52
@maiste maiste force-pushed the chore/changelog-script branch from fd57aae to bb573a9 Compare October 3, 2025 12:53
@maiste
Copy link
Collaborator Author

maiste commented Oct 3, 2025

Thanks, @shonfeder, for the feedback! I went for a hybrid solution. The problem with the cat is if the directory is empty, it will fail. I have updated the find to only look for *.md file. I removed the cat to replace it with a return in case the string is empty. It should improve the readability.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
chore Something that just needs to be done.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

chore: automatically generate CHANGES.md
2 participants