Skip to content

Commit 131577a

Browse files
committed
fix(mantis): preserve telegram account queue
1 parent e996159 commit 131577a

3 files changed

Lines changed: 17 additions & 10 deletions

File tree

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

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -311,11 +311,13 @@ jobs:
311311
while true; do
312312
blockers="$(
313313
for workflow in mantis-telegram-desktop-proof.yml mantis-telegram-live.yml; do
314-
gh run list --repo "$GITHUB_REPOSITORY" --workflow "$workflow" --limit 100 --json databaseId,status,createdAt,url \
315-
| jq -r \
316-
--argjson current_id "$GITHUB_RUN_ID" \
317-
--arg current_created "$current_created" \
318-
'.[] | select(.databaseId != $current_id) | select(.createdAt < $current_created or (.createdAt == $current_created and .databaseId < $current_id)) | select(.status == "queued" or .status == "in_progress" or .status == "waiting" or .status == "pending" or .status == "requested") | "\(.createdAt)\t#\(.databaseId)\t\(.status)\t\(.url)"'
314+
for status in queued in_progress waiting pending requested; do
315+
gh run list --repo "$GITHUB_REPOSITORY" --workflow "$workflow" --status "$status" --limit 100 --json databaseId,status,createdAt,url \
316+
| jq -r \
317+
--argjson current_id "$GITHUB_RUN_ID" \
318+
--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+
done
319321
done | sort -u
320322
)"
321323
if [[ -z "$blockers" ]]; then

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

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -275,11 +275,13 @@ jobs:
275275
while true; do
276276
blockers="$(
277277
for workflow in mantis-telegram-desktop-proof.yml mantis-telegram-live.yml; do
278-
gh run list --repo "$GITHUB_REPOSITORY" --workflow "$workflow" --limit 100 --json databaseId,status,createdAt,url \
279-
| jq -r \
280-
--argjson current_id "$GITHUB_RUN_ID" \
281-
--arg current_created "$current_created" \
282-
'.[] | select(.databaseId != $current_id) | select(.createdAt < $current_created or (.createdAt == $current_created and .databaseId < $current_id)) | select(.status == "queued" or .status == "in_progress" or .status == "waiting" or .status == "pending" or .status == "requested") | "\(.createdAt)\t#\(.databaseId)\t\(.status)\t\(.url)"'
278+
for status in queued in_progress waiting pending requested; do
279+
gh run list --repo "$GITHUB_REPOSITORY" --workflow "$workflow" --status "$status" --limit 100 --json databaseId,status,createdAt,url \
280+
| jq -r \
281+
--argjson current_id "$GITHUB_RUN_ID" \
282+
--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+
done
283285
done | sort -u
284286
)"
285287
if [[ -z "$blockers" ]]; then

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,11 @@ describe("Mantis Telegram Desktop proof workflow", () => {
114114
expect(step.run).toContain("mantis-telegram-desktop-proof.yml");
115115
expect(step.run).toContain("mantis-telegram-live.yml");
116116
expect(step.run).toContain('gh run list --repo "$GITHUB_REPOSITORY"');
117+
expect(step.run).toContain('--status "$status"');
117118
expect(step.run).toContain("GITHUB_RUN_ID");
118119
expect(step.run).toContain(".createdAt < $current_created");
120+
expect(step.run).toContain("for status in queued in_progress waiting pending requested");
121+
expect(step.run).not.toContain('select(.status == "queued"');
119122
expect(step.run).toContain("sleep 60");
120123
}
121124
});

0 commit comments

Comments
 (0)