From 6ac3eabd90eec3e5594eaad0953b639ed8b7e1c8 Mon Sep 17 00:00:00 2001 From: Masafumi Koba <473530+ybiquitous@users.noreply.github.com> Date: Tue, 10 May 2022 23:31:19 +0900 Subject: [PATCH] feat(actions): auto-generate release notes Using the `--generate-notes` flag of the `gh release create` command. Also, the `GITHUB_REF_NAME` environment variable is newly used. See --- .github/workflows/release.yml | 7 ++++--- test/__snapshots__/init.test.js.snap | 7 ++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 83259713..1869ab52 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -18,8 +18,9 @@ jobs: - run: npm publish env: NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} - - run: echo "::set-output name=tag::${GITHUB_REF/refs\/tags\//}" - id: get_tag - - run: gh release create '${{ steps.get_tag.outputs.tag }}' --notes 'See the [changelog](https://github.com/${{ github.repository }}/blob/${{ steps.get_tag.outputs.tag }}/CHANGELOG.md) for more details.' + - run: | + gh release create "${GITHUB_REF_NAME}" \ + --generate-notes \ + --notes "See the [changelog](https://github.com/${GITHUB_REPOSITORY}/blob/${GITHUB_REF_NAME}/CHANGELOG.md) for more details." env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/test/__snapshots__/init.test.js.snap b/test/__snapshots__/init.test.js.snap index 8924551a..242a2f54 100644 --- a/test/__snapshots__/init.test.js.snap +++ b/test/__snapshots__/init.test.js.snap @@ -195,9 +195,10 @@ jobs: - run: npm publish env: NODE_AUTH_TOKEN: \${{ secrets.NPM_TOKEN }} - - run: echo \\"::set-output name=tag::\${GITHUB_REF/refs\\\\/tags\\\\//}\\" - id: get_tag - - run: gh release create '\${{ steps.get_tag.outputs.tag }}' --notes 'See the [changelog](https://github.com/\${{ github.repository }}/blob/\${{ steps.get_tag.outputs.tag }}/CHANGELOG.md) for more details.' + - run: | + gh release create \\"\${GITHUB_REF_NAME}\\" \\\\ + --generate-notes \\\\ + --notes \\"See the [changelog](https://github.com/\${GITHUB_REPOSITORY}/blob/\${GITHUB_REF_NAME}/CHANGELOG.md) for more details.\\" env: GITHUB_TOKEN: \${{ secrets.GITHUB_TOKEN }} "