softprops / action-gh-release

📦 :octocat: GitHub Action for creating GitHub Releases
MIT License
3.91k stars 440 forks source link

it seems like release are always created from the default branch #392

Open jacquesvdm7 opened 9 months ago

jacquesvdm7 commented 9 months ago

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
backwardsEric commented 5 months ago

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.

hahn-kev commented 4 months ago

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