Skip to content

Commit 08c3bc7

Browse files
caoxing9claude
andcommitted
ci(zapier): only block overwrite for PUBLIC versions, not private beta
The guard blocked overwriting any version with users, but pre-publish you must turn on live test Zaps to satisfy Zapier's publishing requirements — all while the version is still private. Refine the guard to allow overwrite while State is private and only block once the version is promoted (public) and has real users. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent a18d61c commit 08c3bc7

1 file changed

Lines changed: 13 additions & 7 deletions

File tree

.github/workflows/zapier.yml

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -73,17 +73,23 @@ jobs:
7373
fi
7474
printf '{"id": %s, "key": "%s"}\n' \
7575
"${{ vars.ZAPIER_APP_ID }}" "${{ vars.ZAPIER_APP_KEY }}" > .zapierapprc
76-
- name: Guard — never overwrite a version that has users
76+
- name: Guard — never overwrite a PUBLIC version that has users
7777
env:
7878
ZAPIER_DEPLOY_KEY: ${{ secrets.ZAPIER_DEPLOY_KEY }}
7979
run: |
8080
VERSION=$(node -p "require('./package.json').version")
81-
USERS=$(npx zapier-platform versions --format json 2>/dev/null \
82-
| jq -r --arg v "$VERSION" \
83-
'[.[] | select(.Version == $v) | (.["Zap Users"] | tonumber)] | add // 0')
84-
echo "Version $VERSION currently has ${USERS:-0} Zap user(s)."
85-
if [ "${USERS:-0}" -gt 0 ]; then
86-
echo "::error::Version $VERSION already has users. Bump the version in packages/zapier/package.json before deploying."
81+
ROW=$(npx zapier-platform versions --format json 2>/dev/null \
82+
| jq -c --arg v "$VERSION" 'map(select(.Version == $v)) | first // {}')
83+
STATE=$(echo "$ROW" | jq -r '.State // "private"')
84+
USERS=$(echo "$ROW" | jq -r '(.["Zap Users"] // "0") | tonumber')
85+
echo "Version $VERSION — state: $STATE, Zap users: $USERS."
86+
# While the version is still private (pre-publish beta), overwrite
87+
# freely — the only live Zaps are your own test users, which you must
88+
# turn on to satisfy Zapier's publishing requirements. Once the version
89+
# is promoted (no longer private) and has real users, refuse to
90+
# overwrite: bump the version and promote instead.
91+
if [ "$STATE" != "private" ] && [ "${USERS:-0}" -gt 0 ]; then
92+
echo "::error::Version $VERSION is $STATE and has $USERS user(s). Bump the version in packages/zapier/package.json, then promote."
8793
exit 1
8894
fi
8995
- name: Push to Zapier (overwrites the same version)

0 commit comments

Comments
 (0)