This is an automated email from the ASF dual-hosted git repository.

gnodet pushed a commit to branch ci/fix-duplicate-container-prs
in repository https://gitbox.apache.org/repos/asf/camel.git

commit eafa8314d481c69bc73defc148a61a415990c0d9
Author: Guillaume Nodet <[email protected]>
AuthorDate: Tue Mar 10 10:31:30 2026 +0100

    chore(ci): prevent duplicate container upgrade PRs
    
    The check-container-versions workflow was creating duplicate PRs for the
    same container upgrade because:
    1. The branch name included the workflow run number, making each run unique
    2. There was no check for existing open PRs before creating a new one
    
    Fix by:
    - Removing the run number from branch names so the same upgrade always
      maps to the same branch
    - Checking for existing open PRs (by branch name and by property name)
      before creating a new one
    
    Co-Authored-By: Claude Opus 4.6 <[email protected]>
---
 .github/workflows/check-container-versions.yml | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/.github/workflows/check-container-versions.yml 
b/.github/workflows/check-container-versions.yml
index a2cebd46466d..61091229fc08 100644
--- a/.github/workflows/check-container-versions.yml
+++ b/.github/workflows/check-container-versions.yml
@@ -276,12 +276,26 @@ jobs:
           EOF
           )
 
-            # Generate unique branch name
-            BRANCH_NAME="automated/upgrade-$(echo "$PROPERTY_NAME" | tr '.' 
'-' | tr '_' '-')-${NEW_VERSION}-${{ github.run_number }}"
+            # Generate branch name (deterministic per property+version, no run 
number)
+            BRANCH_NAME="automated/upgrade-$(echo "$PROPERTY_NAME" | tr '.' 
'-' | tr '_' '-')-${NEW_VERSION}"
 
             echo "Creating PR: $PR_TITLE"
             echo "Branch: $BRANCH_NAME"
 
+            # Check for existing open PR for the same property upgrade
+            EXISTING_PR=$(gh pr list --state open --head "$BRANCH_NAME" --json 
number --jq '.[0].number' 2>/dev/null || echo "")
+            if [[ -n "$EXISTING_PR" ]]; then
+              echo "⏭️  Skipping $PROPERTY_NAME $NEW_VERSION — open PR 
#$EXISTING_PR already exists"
+              continue
+            fi
+
+            # Also check if there is any open PR updating the same property 
(even to a different version)
+            EXISTING_PROPERTY_PR=$(gh pr list --state open --label 
"container-images" --search "upgrade $PROPERTY_NAME" --json number,title --jq 
'.[0].number' 2>/dev/null || echo "")
+            if [[ -n "$EXISTING_PROPERTY_PR" ]]; then
+              echo "⏭️  Skipping $PROPERTY_NAME $NEW_VERSION — open PR 
#$EXISTING_PROPERTY_PR already exists for this property"
+              continue
+            fi
+
             # Configure git
             git config user.name "github-actions[bot]"
             git config user.email 
"github-actions[bot]@users.noreply.github.com"

Reply via email to