create-release icon indicating copy to clipboard operation
create-release copied to clipboard

Tag created on wrong commit

Open dbrekelmans opened this issue 5 years ago • 2 comments

Expected behaviour Tags the last commit

Actual behaviour The commit before the last commit is tagged

Context I have a workflow that makes a new commit & push and then creates a new release.

For full workflow, see: https://github.com/dbrekelmans/bdi/blob/0.3-alpha.1/.github/workflows/release.yml

The relevant part is:

      - name: Commit assets
        id: commit
        uses: EndBug/add-and-commit@v5
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        with:
          message: "Update PHAR distribution to ${{ github.event.client_payload.tag_name }}"
      - name: Wait for git push
        uses: jakejarvis/wait-action@master
        with:
          time: '5s' # Wait for git push to be finished
      - uses: actions/create-release@v1
        if: success() && steps.commit.outputs.committed && steps.commit.outputs.pushed
        with:
          tag_name: ${{ github.event.client_payload.tag_name }}
          release_name: ${{ github.event.client_payload.release_name }}
          prerelease: ${{ github.event.client_payload.prerelease }}
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

As you can see, I've added a wait action for 5 seconds, but this did not resolve the issue. I suspect that the last commit is fetched when the container is built at the start of the job, not when the container is run. In any case, this action doesn't see the commit that was made with EndBug/add-and-commit@v5.

dbrekelmans avatar Dec 13 '20 21:12 dbrekelmans

Hi, I had the same issue and I looked a bit into it.

Correct me if I'm wrong but it looks like the action does not create the new release on the latest commit. Here it seems like the commit on which the release is created is based on the GitHub Action context. I guess this means that if the action is triggered on a pull request event the hash corresponds with the pull request latest commit, not the latest commit in general.

To solve this you can pass to the action the input commitish containing the hash (SHA) you want the release to be created on.

alessiovierti avatar Jan 16 '21 17:01 alessiovierti

Hi, I am facing the same issue. However, it was working fine previously and now instead of tagging the latest commit, it is tagging the commit prior to the latest commit.

riprasad avatar Jan 25 '21 10:01 riprasad