Skip to content

Commit 87748e0

Browse files
committed
chore: use jq
1 parent e59bc81 commit 87748e0

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

.github/workflows/ci.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,10 @@ jobs:
7373
run: |
7474
JSON_OUTPUT=$(yarn turbo run build:android --cache-dir="${{ env.TURBO_CACHE_DIR }}" --dry-run=json)
7575
76-
76+
7777
# Use node -p to parse the JSON *string* and extract the status
7878
# Note the use of JSON.parse() and backticks (`) for the string literal
79-
TURBO_CACHE_STATUS=$(node -p "JSON.parse(\`$JSON_OUTPUT\`).tasks.find(t => t.task === $("build:android")).cache.status")
80-
79+
TURBO_CACHE_STATUS=$(echo "$JSON_OUTPUT" | jq -r '.tasks[] | select(.task == "build:android") | .cache.status // "MISS"')
8180
8281
if [[ $TURBO_CACHE_STATUS == "HIT" ]]; then
8382
echo "turbo_cache_hit=1" >> $GITHUB_ENV
@@ -138,7 +137,7 @@ jobs:
138137
139138
# Use node -p to parse the JSON *string* and extract the status
140139
# Note the use of JSON.parse() and backticks (`) for the string literal
141-
TURBO_CACHE_STATUS=$(node -p "JSON.parse(\`$JSON_OUTPUT\`).tasks.find(t => t.task === $("build:ios")).cache.status")
140+
TURBO_CACHE_STATUS=$(echo "$JSON_OUTPUT" | jq -r '.tasks[] | select(.task == "build:ios") | .cache.status // "MISS"')
142141
143142
if [[ $TURBO_CACHE_STATUS == "HIT" ]]; then
144143
echo "turbo_cache_hit=1" >> $GITHUB_ENV

0 commit comments

Comments
 (0)