File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -45,18 +45,45 @@ jobs:
4545 UV_NO_CONFIG : " 1"
4646 shell : bash
4747 run : |
48+ skip_comparison() {
49+ local reason="$1"
50+ echo "::notice title=Python public API compatibility::$reason"
51+ {
52+ echo "## Python public API compatibility"
53+ echo
54+ echo "Comparison skipped: $reason"
55+ } >> "$GITHUB_STEP_SUMMARY"
56+ exit 0
57+ }
58+
59+ set +e
60+ git ls-remote \
61+ --exit-code \
62+ --refs \
63+ "https://github.com/$GITHUB_REPOSITORY.git" \
64+ "refs/pull/$PR_NUMBER/merge" > /dev/null
65+ ref_status=$?
66+ set -e
67+ if (( ref_status == 2 )); then
68+ skip_comparison "GitHub has not produced a synthetic merge ref for the current pull request head."
69+ fi
70+ if (( ref_status != 0 )); then
71+ echo "Failed to query the pull request merge ref (exit $ref_status)." >&2
72+ exit "$ref_status"
73+ fi
74+
4875 git -C "$GITHUB_WORKSPACE" fetch \
4976 --no-tags \
5077 --no-recurse-submodules \
5178 --depth=2 \
5279 "https://github.com/$GITHUB_REPOSITORY.git" \
5380 "refs/pull/$PR_NUMBER/merge"
81+
5482 MERGE_SHA="$(git -C "$GITHUB_WORKSPACE" rev-parse --verify 'FETCH_HEAD^{commit}')"
5583 BASE_SHA="$(git -C "$GITHUB_WORKSPACE" rev-parse "$MERGE_SHA^1")"
5684 HEAD_SHA="$(git -C "$GITHUB_WORKSPACE" rev-parse "$MERGE_SHA^2")"
5785 if [[ "$HEAD_SHA" != "$EXPECTED_HEAD_SHA" ]]; then
58- echo "Fetched merge ref head $HEAD_SHA does not match event head $EXPECTED_HEAD_SHA." >&2
59- exit 1
86+ skip_comparison "GitHub's synthetic merge ref is not current for pull request head $EXPECTED_HEAD_SHA."
6087 fi
6188
6289 PR_SOURCE="$RUNNER_TEMP/pr-source"
Original file line number Diff line number Diff line change @@ -83,7 +83,9 @@ in the job summary. The experimental `agent-framework-lab` package is excluded.
8383workflow checks out only trusted base-branch code, fetches GitHub's synthetic merge commit
8484without checking it out, and statically parses its Python source from a temporary directory
8585without importing it. This supports fork pull requests while keeping the comparison current
86- when a pull request branch is behind ` main ` .
86+ when a pull request branch is behind ` main ` . If GitHub has not produced a current synthetic
87+ merge ref—typically while the pull request has merge conflicts—the advisory comparison is
88+ skipped and reruns when the pull request is updated.
8789
8890Only APIs from packages marked ` released ` in ` python/PACKAGE_STATUS.md ` are checked.
8991Prerelease packages and APIs marked with ` @experimental ` or ` @release_candidate ` —including
You can’t perform that action at this time.
0 commit comments