Fix false-positive existence check in rollout script

gh api returns error JSON on 404, which made the variable non-empty.
Check exit code instead of output content.
This commit is contained in:
Adam Moussa 2026-05-06 18:07:29 -04:00
parent 5d3aed93c3
commit b7502a3bf8

View file

@ -47,8 +47,7 @@ for repo in $repos; do
echo ""
echo "--- $repo ---"
existing=$(gh api "repos/$ORG/$repo/contents/$WORKFLOW_PATH" --jq '.sha' 2>/dev/null || true)
if [[ -n "$existing" ]]; then
if gh api "repos/$ORG/$repo/contents/$WORKFLOW_PATH" --jq '.sha' > /dev/null 2>&1; then
echo "SKIP $repo (workflow already exists)"
continue
fi