From 0e29ebae8f658f8006b0edcfcc6ae08c71452459 Mon Sep 17 00:00:00 2001 From: Hugh Lyu Date: Mon, 12 Aug 2024 18:11:43 +0800 Subject: [PATCH] ci: Manual notif of the latest release notes. --- .github/workflows/discord-release-notification.yml | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/.github/workflows/discord-release-notification.yml b/.github/workflows/discord-release-notification.yml index 3c21ebd1..32ac4fd0 100644 --- a/.github/workflows/discord-release-notification.yml +++ b/.github/workflows/discord-release-notification.yml @@ -11,11 +11,15 @@ jobs: steps: - name: Set test variables if: ${{ github.event_name == 'workflow_dispatch' }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | - echo "RELEASE_TAG=v1.0.0-test" >> $GITHUB_ENV - echo "RELEASE_NAME=Test Release" >> $GITHUB_ENV - echo "RELEASE_BODY=This is a test release." >> $GITHUB_ENV - echo "RELEASE_URL=https://example.com" >> $GITHUB_ENV + latest_release=$(curl -s -H "Authorization: token $GITHUB_TOKEN" \ + "https://api.github.com/repos/${{ github.repository }}/releases/latest") + echo "RELEASE_TAG=$(echo $latest_release | jq -r .tag_name)" >> $GITHUB_ENV + echo "RELEASE_NAME=$(echo $latest_release | jq -r .name)" >> $GITHUB_ENV + echo "RELEASE_BODY=$(echo $latest_release | jq -r .body)" >> $GITHUB_ENV + echo "RELEASE_URL=$(echo $latest_release | jq -r .html_url)" >> $GITHUB_ENV - name: Dump GitHub context env: