Closed davidsneighbour closed 4 months ago
Did you figure a solution to your problem?
no, sorry.
Long term, it would be good to have this in the tool directly, but here's a short bash snippet I wrote for pact-js that reads the release notes for a github release:
(it also fails if there are no release notes)
# It's easier to read the release notes
# from the commit-and-tag-version tool before it runs
RELEASE_NOTES="$(npx commit-and-tag-version --dry-run | awk 'BEGIN { flag=0 } /^---$/ { if (flag == 0) { flag=1 } else { flag=2 }; next } flag == 1')"
# Don't release if there are no changes
if [ "$(echo "$RELEASE_NOTES" | wc -l)" -eq 1 ] ; then
echo "ERROR: This release would have no release notes. Does it include changes?"
echo " - You must have at least one fix / feat commit to generate release notes"
echo "*** STOPPING RELEASE PROCESS ***"
exit 1
fi
(I wrote this before I forked commit-and-tag-version)
@davidsneighbour check this thread: https://github.com/conventional-changelog/standard-version/issues/610#issuecomment-683337506
The idea is to save the output in a different file other than the Changelog.md, then pass it to your API call.
standard-version -i RELEASE_BODY.md --skip.commit [other options]
I am closing this and recommend reading the link by @Houtheyfa.
The following two lines in my prerelease hook create a file changes.md
with the changelog:
RELEASE_NOTES="$(npx commit-and-tag-version --dry-run | awk 'BEGIN { flag=0 } /^---$/ { if (flag == 0) { flag=1 } else { flag=2 }; next } flag == 1')"
echo "${RELEASE_NOTES}" >changes.md
The curl call in the original issue text is working only if the changes are not too large, else I have to add the text in changes.md manually to the release.
I am aware of #38, but I can't see how this can be helpful for my special use case. After the tag is created, I would like to create a release on GitHub via REST API.
The script to clear probable questions:
The
body
value in the payload could contain the list of changes.Is there an easy way to obtain the changelog changes at some point or do I have to create a post-changelog-creation hook that takes a diff of the changelog into a temporary file to reuse later on? That would be my current idea to implement this.
Thanks for any suggestions.