From ee9a883d3ee577a4812e8ac4b9ed7930305fb974 Mon Sep 17 00:00:00 2001 From: Pavel Dvorkin Date: Wed, 27 Aug 2025 14:37:18 -0400 Subject: [PATCH 1/2] INFRA-2867: Skip version bump PR creation if already exists, commit in main --- .github/scripts/create-platform-release-pr.sh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/scripts/create-platform-release-pr.sh b/.github/scripts/create-platform-release-pr.sh index d3afecb3..82d456a1 100755 --- a/.github/scripts/create-platform-release-pr.sh +++ b/.github/scripts/create-platform-release-pr.sh @@ -404,6 +404,14 @@ Platform: ${platform}" echo "Version bump committed" fi + # If the version bump branch has no commits ahead of main, skip pushing/PR creation + # right-only count gives number of commits unique to the version bump branch + ahead_count=$(git rev-list --right-only --count "${main_branch}...${version_bump_branch_name}" || echo 0) + if [ "${ahead_count}" -eq 0 ]; then + echo "No differences between ${main_branch} and ${version_bump_branch_name}; skipping version bump PR creation." + return 0 + fi + local version_bump_body="## Version Bump After Release This PR bumps the ${main_branch} branch version from ${new_version} to ${next_version} after cutting the release branch. From e6b264f389f23971a69248daca7a80bdea7b93e6 Mon Sep 17 00:00:00 2001 From: Pavel Dvorkin Date: Thu, 28 Aug 2025 09:12:38 -0400 Subject: [PATCH 2/2] INFRA-2867: Skip version bump PR creation if already exists, commit in main Signed-off-by: Pavel Dvorkin --- .github/scripts/create-platform-release-pr.sh | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/.github/scripts/create-platform-release-pr.sh b/.github/scripts/create-platform-release-pr.sh index 82d456a1..d4bb44df 100755 --- a/.github/scripts/create-platform-release-pr.sh +++ b/.github/scripts/create-platform-release-pr.sh @@ -405,8 +405,21 @@ Platform: ${platform}" fi # If the version bump branch has no commits ahead of main, skip pushing/PR creation + # Validate refs before computing ahead count to avoid masking errors + # Fail fast with a error message if the base branch doesn’t exist locally (or isn’t fetched) + # Verifies that ${main_branch} exists and resolves to a valid commit and not a tag, tree, or something else + if ! git rev-parse --verify --quiet "${main_branch}^{commit}" >/dev/null; then + echo "Error: Base branch does not resolve to a commit: ${main_branch}" + exit 1 + fi + # Fail fast with a error message if the version bump branch doesn’t exist locally (or isn’t fetched) + # Verifies that ${version_bump_branch_name} exists and resolves to a valid commit and not a tag, tree, or something else + if ! git rev-parse --verify --quiet "${version_bump_branch_name}^{commit}" >/dev/null; then + echo "Error: Version bump branch does not resolve to a commit: ${version_bump_branch_name}" + exit 1 + fi # right-only count gives number of commits unique to the version bump branch - ahead_count=$(git rev-list --right-only --count "${main_branch}...${version_bump_branch_name}" || echo 0) + ahead_count=$(git rev-list --right-only --count "${main_branch}...${version_bump_branch_name}") if [ "${ahead_count}" -eq 0 ]; then echo "No differences between ${main_branch} and ${version_bump_branch_name}; skipping version bump PR creation." return 0