Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release tags wrong commit #3583

Closed
polothy opened this issue May 16, 2024 · 1 comment · Fixed by #3584
Closed

Release tags wrong commit #3583

polothy opened this issue May 16, 2024 · 1 comment · Fixed by #3584
Labels
bug Something isn't working

Comments

@polothy
Copy link
Contributor

polothy commented May 16, 2024

We recently had two PRs merge and the same time. The one that merged first, ended up tagging the commit of the 2nd. Then the 2nd cancelled itself because the commit was already tagged.

In the release_github job, it has this step to make the tag:

      - name: Release
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          GITHUB_REPOSITORY: ${{ github.repository }}
          GITHUB_REF: ${{ github.ref }}
        run: errout=$(mktemp); gh release create $(cat dist/releasetag.txt) -R $GITHUB_REPOSITORY -F dist/changelog.md -t $(cat dist/releasetag.txt) --target $GITHUB_REF 2> $errout && true; exitcode=$?; if [ $exitcode -ne 0 ] && ! grep -q "Release.tag_name already exists" $errout; then cat $errout; exit $exitcode; fi

The problem, I think, is that GITHUB_REF: ${{ github.ref }} should be GITHUB_REF: ${{ github.sha }}. The ref changed during the release, so it ended up tagging the wrong commit.

@polothy
Copy link
Contributor Author

polothy commented May 16, 2024

Lame attempt: #3584 - at the very least, shows where to fix the problem I think.

@mrgrain mrgrain added the bug Something isn't working label May 17, 2024
@mergify mergify bot closed this as completed in #3584 May 17, 2024
mergify bot pushed a commit that referenced this issue May 17, 2024
…ommits are released at the same time (race condition) (#3584)

The problem, I think, is that `GITHUB_REF: ${{ github.ref }}` should be `GITHUB_REF: ${{ github.sha }}`. The ref changed during the release, so it ended up tagging the wrong commit.

Fixes #3583

---
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
2 participants