forked from BasedHardware/omi
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcm-builds
More file actions
executable file
·34 lines (29 loc) · 966 Bytes
/
Copy pathcm-builds
File metadata and controls
executable file
·34 lines (29 loc) · 966 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/bin/bash
# Codemagic build status checker
# Usage: cm-builds [limit]
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
ROOT_DIR="$(dirname "$SCRIPT_DIR")"
# Load token from .env.local
if [ -f "$ROOT_DIR/.env.local" ]; then
export $(grep CODEMAGIC_API_TOKEN "$ROOT_DIR/.env.local" | xargs)
fi
if [ -z "$CODEMAGIC_API_TOKEN" ]; then
echo "Error: CODEMAGIC_API_TOKEN not set"
echo "Add it to .env.local or export it"
exit 1
fi
LIMIT=${1:-10}
curl -s -H "x-auth-token: $CODEMAGIC_API_TOKEN" \
"https://api.codemagic.io/builds?limit=$LIMIT" | jq -r '
.builds | .[] |
"\(
.status |
if . == "building" then "🔨 BUILDING"
elif . == "finished" then "✅ DONE "
elif . == "queued" then "⏳ QUEUED "
elif . == "canceled" then "❌ CANCELED"
elif . == "failed" then "💥 FAILED "
elif . == "skipped" then "⏭️ SKIPPED "
else .
end
) \((.config.name // "unknown workflow")[0:45]) (\(.branch))"'