diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 97e3eff..abcc2d6 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -561,8 +561,10 @@ jobs: git add CHANGELOG.md git commit -m "docs: update changelog for v${VERSION}" - # Re-runs of the same tag reuse the branch; overwrite it instead of failing. - git push --force origin "$BRANCH" + # Re-runs of the same tag reuse the branch; overwrite it instead of + # failing, but keep --force-with-lease so a foreign commit that landed + # on the branch is not silently discarded. + git push --force-with-lease origin "$BRANCH" if [ -n "$(gh pr list --head "$BRANCH" --state open --json number --jq '.[].number')" ]; then echo "✅ Pull request for $BRANCH already open, updated with latest changelog" @@ -597,8 +599,7 @@ jobs: echo "🔍 Validating release completion for $TAG" # Check GitHub release - # -R is required: this job has no checkout, so gh cannot infer the repo. - if gh release view "$TAG" -R "${{ github.repository }}" >/dev/null 2>&1; then + if gh release view "$TAG" >/dev/null 2>&1; then echo "✅ GitHub release exists" else echo "❌ GitHub release missing" @@ -629,6 +630,10 @@ jobs: echo "🎉 Release validation completed successfully!" env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # This job has no checkout, so `gh` cannot infer the repository from a + # git remote and reported "GitHub release missing" for a release that + # actually existed. + GH_REPO: ${{ github.repository }} - name: Notify on failure if: failure() diff --git a/CHANGELOG.md b/CHANGELOG.md index 7920802..fdbca9c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,8 +8,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] ### Fixed -- Release workflow: `post-release-validation` now passes `-R ` to `gh release view`, - so the check no longer fails with "GitHub release missing" in a job without a checkout. +- Release workflow: `post-release-validation` now sets `GH_REPO` for the step, so `gh` + resolves the repository in a job without a checkout instead of failing the check with + "GitHub release missing". - Release workflow: the PyPI verification uses the PyPI JSON API with retries instead of the experimental `pip index versions` plus a substring `grep`. - Release workflow: `update-docs` opens a pull request with the changelog update instead of