Skip to content

Commit d75e16a

Browse files
committed
fix(mantis): ignore stale telegram queue blockers
1 parent 131577a commit d75e16a

3 files changed

Lines changed: 8 additions & 2 deletions

File tree

.github/workflows/mantis-telegram-desktop-proof.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,7 @@ jobs:
308308
run: |
309309
set -euo pipefail
310310
current_created="$(gh api "repos/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}" --jq .created_at)"
311+
stale_before="$(date -u -d '8 hours ago' +%Y-%m-%dT%H:%M:%SZ)"
311312
while true; do
312313
blockers="$(
313314
for workflow in mantis-telegram-desktop-proof.yml mantis-telegram-live.yml; do
@@ -316,7 +317,8 @@ jobs:
316317
| jq -r \
317318
--argjson current_id "$GITHUB_RUN_ID" \
318319
--arg current_created "$current_created" \
319-
'.[] | select(.databaseId != $current_id) | select(.createdAt < $current_created or (.createdAt == $current_created and .databaseId < $current_id)) | "\(.createdAt)\t#\(.databaseId)\t\(.status)\t\(.url)"'
320+
--arg stale_before "$stale_before" \
321+
'.[] | select(.databaseId != $current_id) | select(.createdAt >= $stale_before) | select(.createdAt < $current_created or (.createdAt == $current_created and .databaseId < $current_id)) | "\(.createdAt)\t#\(.databaseId)\t\(.status)\t\(.url)"'
320322
done
321323
done | sort -u
322324
)"

.github/workflows/mantis-telegram-live.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,7 @@ jobs:
272272
run: |
273273
set -euo pipefail
274274
current_created="$(gh api "repos/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}" --jq .created_at)"
275+
stale_before="$(date -u -d '8 hours ago' +%Y-%m-%dT%H:%M:%SZ)"
275276
while true; do
276277
blockers="$(
277278
for workflow in mantis-telegram-desktop-proof.yml mantis-telegram-live.yml; do
@@ -280,7 +281,8 @@ jobs:
280281
| jq -r \
281282
--argjson current_id "$GITHUB_RUN_ID" \
282283
--arg current_created "$current_created" \
283-
'.[] | select(.databaseId != $current_id) | select(.createdAt < $current_created or (.createdAt == $current_created and .databaseId < $current_id)) | "\(.createdAt)\t#\(.databaseId)\t\(.status)\t\(.url)"'
284+
--arg stale_before "$stale_before" \
285+
'.[] | select(.databaseId != $current_id) | select(.createdAt >= $stale_before) | select(.createdAt < $current_created or (.createdAt == $current_created and .databaseId < $current_id)) | "\(.createdAt)\t#\(.databaseId)\t\(.status)\t\(.url)"'
284286
done
285287
done | sort -u
286288
)"

test/scripts/mantis-telegram-desktop-proof-workflow.test.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,8 @@ describe("Mantis Telegram Desktop proof workflow", () => {
118118
expect(step.run).toContain("GITHUB_RUN_ID");
119119
expect(step.run).toContain(".createdAt < $current_created");
120120
expect(step.run).toContain("for status in queued in_progress waiting pending requested");
121+
expect(step.run).toContain("stale_before=");
122+
expect(step.run).toContain(".createdAt >= $stale_before");
121123
expect(step.run).not.toContain('select(.status == "queued"');
122124
expect(step.run).toContain("sleep 60");
123125
}

0 commit comments

Comments
 (0)