Skip to content

Commit 9f40456

Browse files
author
Matus Kasak
committed
Improve finding the id of rest tests
1 parent c0ea2ef commit 9f40456

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

.github/workflows/deploy.yml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -234,8 +234,9 @@ jobs:
234234
--workflow "$WORKFLOW" \
235235
--event workflow_dispatch \
236236
--created ">=$TRIGGER_TIME" \
237-
--json databaseId \
238-
--jq '.[0].databaseId // empty')
237+
--limit 1 \
238+
--json databaseId,createdAt \
239+
--jq 'sort_by(.createdAt) | .[0].databaseId // empty')
239240
240241
if [[ -n "$RUN_ID" ]]; then
241242
echo "Found workflow run: $RUN_ID"
@@ -287,16 +288,17 @@ jobs:
287288
echo "Workflow dispatch triggered, waiting for run to appear..."
288289
sleep 15
289290
290-
# Find the run we just triggered
291+
# Find the run we just triggered (oldest after TRIGGER_TIME)
291292
RUN_ID=""
292293
for i in $(seq 1 12); do
293294
RUN_ID=$(gh run list \
294295
--repo "$REPO" \
295296
--workflow "$WORKFLOW" \
296297
--event workflow_dispatch \
297298
--created ">=$TRIGGER_TIME" \
298-
--json databaseId \
299-
--jq '.[0].databaseId // empty')
299+
--limit 1 \
300+
--json databaseId,createdAt \
301+
--jq 'sort_by(.createdAt) | .[0].databaseId // empty')
300302
301303
if [[ -n "$RUN_ID" ]]; then
302304
echo "Found workflow run: $RUN_ID"

0 commit comments

Comments
 (0)