action-gh-release icon indicating copy to clipboard operation
action-gh-release copied to clipboard

it seems like release are always created from the default branch

Open jacquesvdm7 opened this issue 2 years ago • 2 comments

This is the extract from the script to create the release and when I check the release notes generated it's obvious that it's for the master branch and not for the PRODUCTION branch that triggered the workflow. Is this a bug or by design?

  - name: Release
    id: create_release
    uses: softprops/action-gh-release@v1

if: startsWith(github.ref, 'refs/tags/')

    env:
      GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN  }}
    with:
      name: ${{ github.event.inputs.releaseName }}
      tag_name: ${{ github.event.inputs.releaseTag }}
      generate_release_notes: ${{ env.GENERATE_RELEASE_NOTES }}
      files: |
        ${{ github.workspace }}/${{ env.BUILD_TARGET_PATH }}/${{ env.WEBAPP_NAME }}.jar
        ${{ github.workspace }}/${{ env.BUILD_TARGET_PATH }}/${{ env.WEBAPP_NAME }}.zip

jacquesvdm7 avatar Oct 18 '23 11:10 jacquesvdm7

According to the readme, it is by design. In the section about optional keys for "with" the readme says: "target_committish - Commitish value that determines where the Git tag is created from. Can be any branch or commit SHA. Defaults to repository default branch."

Inserting

      target_commitish: {{ github.sha }}

before the "files: |" line near the end of your workflow should give you the behavior you want.

backwardsEric avatar Feb 09 '24 22:02 backwardsEric

we were just caught out by this, seems strange that it wouldn't default to targeting the commit that triggered the action to execute.

hahn-kev avatar Mar 06 '24 07:03 hahn-kev