softprops / action-gh-release

šŸ“¦ :octocat: GitHub Action for creating GitHub Releases
MIT License
3.91k stars 440 forks source link

Unable to overwrite an existing draft release #413

Open mitchelbaker-cisa opened 5 months ago

mitchelbaker-cisa commented 5 months ago

I've been building a workflow to automate our project's release process. We create release branches then merge to main, so the objective was to create a draft release when a release PR is created. If new features are merged into the release branch, then this requires the existing draft release to be updated. However, after tinkering around and looking at other issues this functionality is not possible.

There's already proposed PRs with a fix along and a few issues requesting this.

PRs:

Issues:

As noted in the README, šŸ’” When the release info keys (such as name, body, draft, prerelease, etc.) are not explicitly set and there is already an existing release for the tag, the release will retain its original info.

I have each of these keys so the existing release should be updated here. Another action is being used to generate the changelog but it functions as expected, if anything action-gh-release should recognize that the body has new information and update accordingly.

on:
    workflow_dispatch:
    pull_request:
      types: 
        - opened
        - synchronize
      branches:
        - 'release-*'

jobs:

  ...

  build-release:
    if: startsWith(github.head_ref, 'release')
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v4

      ...

      - name: Create Draft Release 
        uses: softprops/action-gh-release@v0.1.15
        with:
          name: "v${{ env.version }}"
          tag_name: "v${{ env.version }}"
          body: |
            ## [${{ env.version }}] - Timberrrrr! - ${{ env.date }} 
            ${{ steps.release.outputs.changelog }}
          files: v${{ env.version }}.zip
          draft: true
          prerelease: false
          discussion_category_name: "Announcements"
          generate_release_notes: false
          fail_on_unmatched_files: true