Open SmileyChris opened 1 month ago
I am using towncrier --draft
from my project as part of CI to make sure there is no invalid RST syntax in those files.
I am not using pre-commit hooks for my projects ... so I don't know how and why they should be used.
I think that we should start fixing this issue by documenting the pre-commit hooks so that we have the information of what we want to achieve with the hook
Things that I check for a branch / PR:
Things that are needed and not yet implemented
pre-commit is useful to enforce standards. Since it needs active buy-in from your developers to actually use it, it usually lives as a git action too to actually enforce it :)
From the things you check for, I'd say we should have different hooks that do each of those:
check
to actually check for newsfragments (since we have a towncrier command of the same name).
stage
should be pre-push
validate
which ensures the validity of the compiled news file (and maybe fragments too) This should be an extension of towncrier check
tbh.
types: ['text']
towncrier check
ensuring there are no loose fragments? This probably isn't that useful as a hook, since you can't tie hooks to a specific branch merge.So far the approach is to have a single towncrier check
that does everything.
towncrier check
should be smart enough to detect when we have a normal branch, a release branch or a revert branch, and do its magic.
Since this discussion was getting a bit esoteric, I thought it would be good to actually just suggest the changes to the current hooks. The current towncrier-check
hook is confusing since all it does is build --draft
when we have a check action.
This seems an unnatural correlation and I'm not sure what the purpose of the current hook (
towncrier --draft
) would really even be!Also, it would make sense that this always runs, not just when a file is found in
newsfragments/
since the check is supposed to be checking whether or not there are actually changelog updates, correct?