Skip to content

Commit 87bf76a

Browse files
committed
fix: prevent orchestrator race conditions with validation guard
1 parent 6ca8698 commit 87bf76a

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

.github/workflows/orchestrator.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,15 @@ jobs:
3939
STATUS=$(echo "$BODY" | grep "Status:" | cut -d':' -f2 | xargs)
4040
CURRENT=$(echo "$BODY" | grep "Current:" | cut -d':' -f2 | xargs | tr -d '#')
4141
42+
# Guard: Only process workflow_run if it matches the CURRENT task
43+
if [ "$EVENT_NAME" == "workflow_run" ]; then
44+
RUN_TITLE="${{ github.event.workflow_run.display_title }}"
45+
if [[ "$RUN_TITLE" != *"$CURRENT"* ]]; then
46+
echo "Workflow run '$RUN_TITLE' does not match current task #$CURRENT. Skipping."
47+
exit 0
48+
fi
49+
fi
50+
4251
# If not IN_PROGRESS, only allow manual trigger to start
4352
if [ "$STATUS" != "IN_PROGRESS" ] && [ "$EVENT_NAME" != "issue_comment" ]; then
4453
echo "Status is $STATUS. Waiting for manual /orchestrate command."

0 commit comments

Comments
 (0)