Skip to content

chore(script): generate changelog from structure - #12516

Merged
shonfeder merged 4 commits into
ocaml:mainfrom
maiste:chore/changelog-script
Oct 10, 2025
Merged

shonfeder merged 4 commits into
ocaml:mainfrom
maiste:chore/changelog-script

Conversation

@maiste

@maiste maiste commented Sep 29, 2025 •

Copy link
Copy Markdown
Collaborator

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 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

@shonfeder shonfeder left a comment

Copy link
Copy Markdown
Member

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 thread doc/changes/scripts/build_changelog.sh Outdated
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
Copy Markdown
Member

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 "".

Comment thread doc/changes/scripts/build_changelog.sh Resolved
Comment thread doc/changes/scripts/build_changelog.sh Outdated
exit 1
fi

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

Copy link
Copy Markdown
Member

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.

Comment thread doc/changes/scripts/build_changelog.sh Resolved
@maiste
maiste force-pushed the chore/changelog-script branch 2 times, most recently from fd57aae to bb573a9 Compare October 3, 2025 12:53
@maiste

maiste commented Oct 3, 2025 •

Copy link
Copy Markdown
Collaborator Author

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.

@maiste
maiste force-pushed the chore/changelog-script branch from bb573a9 to 2a57a8f Compare October 7, 2025 09:14
@maiste
maiste marked this pull request as ready for review October 7, 2025 09:14
@maiste
maiste requested a review from shonfeder October 7, 2025 09:14

@shonfeder shonfeder left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM! Thanks :)

@shonfeder
shonfeder merged commit d73797e into ocaml:main Oct 10, 2025
@maiste
maiste deleted the chore/changelog-script branch October 10, 2025 23:16
davesnx added a commit to davesnx/dune that referenced this pull request Oct 14, 2025
* 'main' of github.com:/ocaml/dune: (147 commits)
  cram test: test only parameter flags in merlin generation
  fix(oxcaml): import eta-expansion changes from opam-repo (ocaml#12563)
  address review comments
  Mask the path to the stdlib
  fix(oxcaml): generate merlin config for library parameters
  fix(melange + include_qualified): track correct `.cmj` dependencies in emit (ocaml#12531)
  refactor: remove some unused code in [Path] (ocaml#12558)
  dep_rules: don't run (transitive) `ocamldep` on single module buildables (ocaml#12555)
  fix(pkg): ignore project settings for building packages
  test(pkg): reproduce ocaml#12131
  melange: add a test for module cycle checks (ocaml#12554)
  chore: lint check for new changes entries (ocaml#12553)
  feature(cram): allow for conflict detection (ocaml#12538)
  ci: update for ocaml 5.4 release (ocaml#12552)
  chore(script): generate changelog from structure (ocaml#12516)
  Reuse dependencies between project and tools (ocaml#12526)
  Introduce Io.overwrite_file
  test: fix dune install requiring a mandir
  Enable package management for more tests
  Add a `dune tools env` command to add dev tools to PATH (ocaml#12521)
  ...
MisterDA pushed a commit to MisterDA/dune that referenced this pull request Nov 13, 2025
@Alizter Alizter added this to the 3.21.0 milestone Jul 8, 2026
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.

chore: automatically generate CHANGES.md

3 participants