From 8d2e01c74f4ab205e9af48ef74da837ec758d870 Mon Sep 17 00:00:00 2001 From: cmyers-mieweb Date: Mon, 18 May 2026 10:15:14 -0700 Subject: [PATCH] Handle container creation 409 conflict Add handling for HTTP 409 (conflict) when creating a container in action.yml. If the API returns 409, extract the existing container ID from the response using jq, log a message, and emit container_id and container_ready outputs so concurrent workflow race conditions reuse the existing container. Other non-success responses keep the existing error handling. --- action.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/action.yml b/action.yml index 9a056a1..e9b2e01 100644 --- a/action.yml +++ b/action.yml @@ -194,6 +194,12 @@ runs: echo "container_id=$NEW_ID" >> $GITHUB_OUTPUT echo "job_id=$JOB_ID" >> $GITHUB_OUTPUT echo "container_created=true" >> $GITHUB_OUTPUT + elif [ "$CREATE_CODE" -eq 409 ]; then + # Container already exists (race condition with concurrent workflow) + EXISTING_ID=$(echo "$CREATE_BODY" | jq -r '.container.id // empty') + echo "Container already exists (conflict). Using existing container ID: $EXISTING_ID" + echo "container_id=$EXISTING_ID" >> $GITHUB_OUTPUT + echo "container_ready=true" >> $GITHUB_OUTPUT else echo "::error::Failed to create container. HTTP: $CREATE_CODE" echo " Response: $CREATE_BODY"