softprops / action-gh-release

📦 :octocat: GitHub Action for creating GitHub Releases

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

it seems like release are always created from the default branch

jacquesvdm7 opened this issue · 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

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.

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