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

Running check after building the changelog #152

Closed
energizah opened this issue Jun 19, 2019 · 7 comments · Fixed by #337
Closed

Running check after building the changelog #152

energizah opened this issue Jun 19, 2019 · 7 comments · Fixed by #337
Labels

Comments

@energizah
Copy link

I'm admittedly still figuring out the workflow for towncrier.

I'm trying something like:

# Checkout the new feature branch.
git checkout -b newbranch 
# Make a change.
echo 'def f(): ...' >> pkg/__init__.py   
# Commit the change.
git commit -am'Add __init__.py'
# Add the newsfragment
echo 'Make pkg into a package.' > changelog.d/123.change
# Bump the version number
bump2version patch
# Check for newsfragments
python -m towncrier.check
# Update changelog
towncrier --yes
# Ready to go? Let's double check everything.
# Run `tox -e check` which includes...
python -m towncrier.check
# which fails.

This last step fails because I've already updated the changelog and removed the fragments. Could towncrier.check figure out that it's already handled the newsfragments for this branch?

@altendky
Copy link
Member

@energizah, are you satisfied that the other issues and PR cover this? In other words, is closing as duplicate appropriate?

@energizah
Copy link
Author

energizah commented Nov 26, 2020

The original post above says

This last step fails because I've already updated the changelog and removed the fragments

which is both the input files and the output files. But the PR only mentions the output files:

not fail when a pull request only modifies the configured news file

so I'm not sure.

@altendky
Copy link
Member

I think the 'only' refers to not requiring that you have a new newsfragment, which is the normal thing being checked presently. I don't think there's any checking to make sure you have not removed newsfragments. Presently towncrier check works for feature/bugfix/etc PRs. My expectation is that the PR would make it also able to handle release PRs where towncrier has been called and consumed the newsfragments and updated the changelog. Do these expectations cover your needs? Maybe I should have been thinking of #246 as the duplicate but... anyways, forget closing this. Just make sure I am trying to achieve what you need.

@energizah
Copy link
Author

energizah commented Nov 27, 2020

Do these expectations cover your needs?

I think so.

For concreteness, my scenario has an MWE in the OP. (edit: it's actually not a complete mwe, nevermind.)

@adiroiban
Copy link
Member

I would say that the current behavior is expected.

--check is checking if you can build a valid NEWS / Release file.

If you have just generated the file... you can't generate it again, so --check should fail.

From the description on this issue, it looks like you are trying to use --check for post release checks...but my understand is that check is designed for pre release checks.

Maybe rename --check to --check-pre-release ... and later we can add --check-release

@adiroiban
Copy link
Member

To fix this issue, I think that we should start by documenting the --check command.
I don't see anything about it inside README or towncrier --help.

@energizah
Copy link
Author

Instead of renaming --check to indicate when you're supposed to run it (--check-pre-release), it's at least worth considering a name that says what it checks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment