From 589f1cb89fde7fd1017bd341c93cd540f63cc88c Mon Sep 17 00:00:00 2001 From: Rick van der Linden Date: Wed, 29 Apr 2026 14:36:00 +0200 Subject: [PATCH 1/2] Skip rerun-danger when target workflow not yet expanded --- .github/workflows/rerun-danger.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/rerun-danger.yml b/.github/workflows/rerun-danger.yml index 2adfdee..0245425 100644 --- a/.github/workflows/rerun-danger.yml +++ b/.github/workflows/rerun-danger.yml @@ -66,9 +66,12 @@ jobs: "https://circleci.com/api/v2/pipeline/$PIPELINE_ID/workflow" \ | jq -c --arg name "$WORKFLOW_NAME" 'first(.items[] | select(.name == $name))') + # If the target workflow doesn't exist yet, the setup pipeline is + # still expanding the dynamic config. The initial run will execute + # once expansion completes, so there's nothing to rerun. if [[ -z "$TARGET_WORKFLOW" || "$TARGET_WORKFLOW" == "null" ]]; then - echo "::error::No '$WORKFLOW_NAME' workflow found in pipeline $PIPELINE_ID" - exit 1 + echo "No '$WORKFLOW_NAME' workflow in pipeline $PIPELINE_ID yet — skipping rerun." + exit 0 fi WORKFLOW_ID=$(echo "$TARGET_WORKFLOW" | jq -r '.id') From e35b17ffb5941c39b3a0bcd5df203db6cc0946c6 Mon Sep 17 00:00:00 2001 From: Rick van der Linden Date: Wed, 29 Apr 2026 14:40:24 +0200 Subject: [PATCH 2/2] Generalise comment for skip-when-missing branch --- .github/workflows/rerun-danger.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/rerun-danger.yml b/.github/workflows/rerun-danger.yml index 0245425..b8baf0c 100644 --- a/.github/workflows/rerun-danger.yml +++ b/.github/workflows/rerun-danger.yml @@ -66,9 +66,9 @@ jobs: "https://circleci.com/api/v2/pipeline/$PIPELINE_ID/workflow" \ | jq -c --arg name "$WORKFLOW_NAME" 'first(.items[] | select(.name == $name))') - # If the target workflow doesn't exist yet, the setup pipeline is - # still expanding the dynamic config. The initial run will execute - # once expansion completes, so there's nothing to rerun. + # If the target workflow doesn't exist yet, CircleCI hasn't created + # the pipeline run for this label change. The initial run will + # execute once it does, so there's nothing to rerun. if [[ -z "$TARGET_WORKFLOW" || "$TARGET_WORKFLOW" == "null" ]]; then echo "No '$WORKFLOW_NAME' workflow in pipeline $PIPELINE_ID yet — skipping rerun." exit 0