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

Add option to use annotated tag message as release notes #162

Open
spenserblack opened this issue Sep 22, 2021 · 9 comments
Open

Add option to use annotated tag message as release notes #162

spenserblack opened this issue Sep 22, 2021 · 9 comments

Comments

@spenserblack
Copy link

Annotated tags can contain release notes, and it would be nice if this action provided an option to use the tag's message as the GitHub Release notes.

@spenserblack
Copy link
Author

Note: Looks like git tag -l --format="%(contents:body)" <tag name> gets the tag message.
Until this is implemented a workaround could be to write the contents to a file and use body_path,
or set the result as an output in a previous step.

@spenserblack
Copy link
Author

I think I finally got the workaround working 😩
This is an example of what I did

name: Release
on:
  push:
    tags: ['v*.*.*']

jobs:
  release-notes:
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v2
        with:
          ref: ${{ github.ref }}
      - name: Get Release Notes
        run: 'echo "$(git tag -l --format="%(contents:body)" $GITHUB_REF_NAME)" > RELEASE_NOTES'
      - name: Set Release Notes
        uses: softprops/action-gh-release@v1
        with:
          body_path: RELEASE_NOTES

@softprops
Copy link
Owner

Neat trick. Quick heads up this action now supports GitHubs automatically generated release notes

generate_release_notes:

@Fuseteam
Copy link

I would still like to use the tag annotation as release notes xd

@spenserblack
Copy link
Author

@Fuseteam I ended up writing a simple action that uses gh since I was repeating the same workflow a lot. It doesn't do much except take the subject (first line) of a tag message and make it the release title, and take the body (lines 3 and over) and make it the release body. Feel free to check it out 😃
If you need more complicated usage, you can use tag-to-release to create a release and this action to do other stuff like upload assets.

@Fuseteam
Copy link

@spenserblack awesome i'll take a look xD

@Fuseteam
Copy link

Fuseteam commented Mar 22, 2022

@spenserblack i tried to combine it but it used my commit message as the title and left the body empty xd i think this overwrote it :p

@spenserblack
Copy link
Author

spenserblack commented Mar 22, 2022

Oh yeah it pretty naively tries to get the latest tag message. It also needs to be checked out at the ref (see the actions/checkout part of the example). The action actually uses itself, so you can see that as an example.
https://github.com/spenserblack/actions-tag-to-release/blob/d5607a72fb47a8614e1154ca456d5b7eaf0c10ab/.github/workflows/release.yml#L1-L16

If you have any more trouble with it please open an issue on that repo 🙂

@Fuseteam
Copy link

Cool thanks~

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

3 participants