Skip to content
This repository has been archived by the owner on Mar 4, 2021. It is now read-only.

Tag created on wrong commit #111

Open
dbrekelmans opened this issue Dec 13, 2020 · 2 comments
Open

Tag created on wrong commit #111

dbrekelmans opened this issue Dec 13, 2020 · 2 comments

Comments

@dbrekelmans
Copy link

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.

@alessiovierti
Copy link

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.

@riprasad
Copy link

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants