Skip to content

[Question] Is there any way to get access to the auto generated release notes in a subsequent step? #617

Open
@cjshrader

Description

@cjshrader

I'll share my entire file but the last two steps are the important ones. We generate the release in the second to last step, then post it to discord.

The release notes are auto generated. Is there any way to get access to them after the release is complete so that I can post them to discord as well?

name: Release

on:
  pull_request:
    types: [closed]
  workflow_dispatch:

concurrency:
  group: release

jobs:
  release:
    if: |
      github.event_name != 'pull_request' ||
        (
          github.event.pull_request.merged == true &&
          contains(github.event.pull_request.labels.*.name, 'release')
        )
    runs-on: windows-latest
    steps:
      - name: Checkout repository
        uses: actions/checkout@v4
        with:
          lfs: false # change to true when building benchmarks

      - name: Setup env
        uses: ./.github/actions/setup_env

      - name: Build & Zip exe
        id: build_zip
        shell: powershell
        run: |
          python build.py
          $version = python -c "from src import __version__; print(__version__)"
          echo "VERSION=$version" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
          $folderName = "d4lf_v" + $version
          Compress-Archive -Path $folderName -DestinationPath "$folderName.zip"

      - name: Create Tag
        shell: powershell
        run: |
          git tag "v${{ env.VERSION }}"
          git push origin "v${{ env.VERSION }}"

      - name: Check if beta
        id: check_beta
        shell: powershell
        run: |
          if ($env:VERSION -like "*beta*" -or $env:VERSION -like "*alpha*") {
            echo "IS_BETA=true" | Out-File -Append -FilePath $env:GITHUB_ENV -Encoding utf8
          } else {
            echo "IS_BETA=false" | Out-File -Append -FilePath $env:GITHUB_ENV -Encoding utf8
          }
  - name: Release
    id: release
    uses: softprops/action-gh-release@v2
    with:
      files: d4lf_v*.zip
      generate_release_notes: true
      name: "v${{ env.VERSION }}"
      prerelease: ${{ env.IS_BETA == 'true' }}
      tag_name: "v${{ env.VERSION }}"

  - name: Send message to Discord
    shell: powershell
    run: |
      $webhookUrl = "${{ secrets.DISCORD_WEBHOOK }}"
      $payload = @{
          username = "GitHub"
          content = "**D4LF v${{ env.VERSION }}**`n`nRelease Page: <${{ steps.release.outputs.url }}>"
          allowed_mentions = @{
            parse = @()
          }
      } | ConvertTo-Json
      Invoke-RestMethod -Uri $webhookUrl -Method Post -ContentType "application/json" -Body $payload

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions