From ae6a750079185cfce828d6f309be2a7c44975a08 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20M=C3=B6ller?= Date: Fri, 21 Jan 2022 19:51:05 +0100 Subject: [PATCH] Enhancement: Automatically generate release body --- .github/workflows/release.yaml | 41 +++++++++++++++++++++++++--------- 1 file changed, 31 insertions(+), 10 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 11ff85ac..d911ac32 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -14,16 +14,37 @@ jobs: runs-on: "ubuntu-latest" steps: - - name: "Determine tag" - id: "determine-tag" - run: "echo \"::set-output name=tag::${GITHUB_REF#refs/tags/}\"" + - name: "Determine release tag" + run: "echo \"RELEASE_TAG=${GITHUB_REF#refs/tags/}\" >> $GITHUB_ENV" + + - name: "Determine release body" + uses: "actions/github-script@v5" + with: + github-token: "${{ secrets.ERGEBNIS_BOT_TOKEN }}" + script: | + const repository = context.repo; + + const response = await github.rest.repos.generateReleaseNotes({ + owner: repository.owner, + repo: repository.repo, + tag_name: "${{ env.RELEASE_TAG }}", + }) + + core.exportVariable("RELEASE_BODY", response.data.body) - name: "Create release" - uses: "actions/create-release@v1.1.4" - env: - GITHUB_TOKEN: "${{ secrets.ERGEBNIS_BOT_TOKEN }}" + uses: "actions/github-script@v5" with: - draft: false - prerelease: false - release_name: "${{ steps.determine-tag.outputs.tag }}" - tag_name: "${{ steps.determine-tag.outputs.tag }}" + github-token: "${{ secrets.ERGEBNIS_BOT_TOKEN }}" + script: | + const repository = context.repo + + await github.rest.repos.createRelease({ + body: "${{ env.RELEASE_BODY }}", + draft: false, + name: "${{ env.RELEASE_TAG }}", + owner: repository.owner, + prerelease: false, + repo: repository.repo, + tag_name: "${{ env.RELEASE_TAG }}", + })