diff --git a/.github/workflows/pr.yaml b/.github/workflows/pr.yaml index 9fd725d2060..84983ba724a 100644 --- a/.github/workflows/pr.yaml +++ b/.github/workflows/pr.yaml @@ -56,27 +56,49 @@ jobs: uses: actions/checkout@v6 with: ref: ${{ github.event.pull_request.head.sha }} + - name: Detect the release tooling on the PR head + id: tooling + # The job builds from the reviewed head, not the merge commit, so a + # branch that predates the release tooling has no script to run. + # Skip the build with a notice instead of failing the PR; the + # ReleaseLock job above still checks the lock on the merge commit. + run: | + if [ -f .github/release_lock.py ] && [ -f .github/release_build.py ]; then + echo "present=true" >> "$GITHUB_OUTPUT" + else + echo "present=false" >> "$GITHUB_OUTPUT" + echo "::notice title=Candidate wheel skipped::The PR head predates the release tooling (.github/release_lock.py and .github/release_build.py). Merge main into the branch to build its candidate wheel." + fi - name: Set up Python + if: steps.tooling.outputs.present == 'true' uses: actions/setup-python@v6 with: python-version: "3.14.7" - name: Install uv + if: steps.tooling.outputs.present == 'true' uses: astral-sh/setup-uv@v8.1.0 with: version: "0.12.13" - name: Check committed registry lock + if: steps.tooling.outputs.present == 'true' run: python .github/release_lock.py --committed - name: Predict release version with the release helper + if: steps.tooling.outputs.present == 'true' run: python .github/release_build.py --prepare "${{ matrix.kind }}" - name: Refresh only the release version in the registry lock + if: steps.tooling.outputs.present == 'true' run: python .github/release_lock.py --refresh - name: Install package + if: steps.tooling.outputs.present == 'true' run: uv sync --locked --extra dev - name: Build package from unchanged policy source + if: steps.tooling.outputs.present == 'true' run: uv run --no-sync make - name: Record and verify release build + if: steps.tooling.outputs.present == 'true' run: uv run --no-sync python .github/release_build.py - name: Retain unpublished wheel and build receipt + if: steps.tooling.outputs.present == 'true' uses: actions/upload-artifact@v4 with: name: release-wheel-${{ matrix.kind }}-${{ github.event.pull_request.head.sha }} diff --git a/changelog.d/ci-candidate-wheel-skip-legacy-heads.fixed.md b/changelog.d/ci-candidate-wheel-skip-legacy-heads.fixed.md new file mode 100644 index 00000000000..045265d5216 --- /dev/null +++ b/changelog.d/ci-candidate-wheel-skip-legacy-heads.fixed.md @@ -0,0 +1 @@ +Skip the pull-request candidate wheel build, with a notice, when the PR head predates the release tooling, instead of failing the check on every branch opened before that tooling landed.