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

check that only the last section of the changelog was modified #68

Open
edublancas opened this issue Jul 11, 2023 · 0 comments
Open

check that only the last section of the changelog was modified #68

edublancas opened this issue Jul 11, 2023 · 0 comments

Comments

@edublancas
Copy link
Collaborator

edublancas commented Jul 11, 2023

we recently added an utility to throw an error if a file hasn't been modified: https://github.com/ploomber/pkgmt/blob/main/src/pkgmt/fail_if_not_modified.py

we're using this on github actions to throw an error when somebody opens a PR and doesn't update the CHANGELOG.md. However, when a new release is made (hence the changelog.md modified to reflect the new development version), the PR branch becomes outdated, making the changelog entry incorrect.

example:

  1. a new branch is created to work on a new feature, at this time. the development version is 0.1dev
  2. the feature author opens a PR and adds a changelog entry under the 0.1dev section
  3. the feature author asks for a review
  4. a new release is made using the master branch (release version=0.1.), new development version is 0.1.1dev
  5. the PR is reviewed and merged

After merging, the changelog is incorrect because the PR entry was created under 0.1dev instead of 0.1.1dev

I believe the only way to detect this problem is when merging the PR: we can check whether any new commit that appears on the master/main branch is modifying the CHANGELOG.md (some don't modify it and that's allowed), and if so, check which section is modifying. if the modification is outside of the development version, we should fail the CI.

note that this has some edge cases. for example, if I add a commit (A) to master/main and modify the first section, but then add another commit (B) and modify the latest one. the CI will pass, even though I modified the first section in commit A. But I don't know if there's anything better we can do. because we cannot detect this problem during the PR CI run (or can we?) - since the release can happen at any time: during the review, after the review, right before merging it. I guess the only way is if we only allow to merge PRs that have been merged/rebased with respect to master, which will guarantee that the CHANGELOG.md version in the PR has the latest development version.

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

No branches or pull requests

1 participant