Files
botpress--botpress/.github/scripts/integration-exists.sh
T
2026-07-13 13:34:48 +08:00

19 lines
653 B
Bash
Executable File

#!/bin/bash
if [ -z "$1" ]; then
echo "Error: integration name is not provided" >&2
exit 1
fi
integration=$1
integration_path="integrations/$integration"
if ! integration_def=$(pnpm bp read --work-dir "$integration_path" --json); then
echo "Error: Failed to read integration definition for \"$integration\". Check the integration for TypeScript errors." >&2
exit 1
fi
name=$(echo "$integration_def" | jq -r ".name")
version=$(echo "$integration_def" | jq -r ".version")
exists=$(pnpm bp integrations ls --name "$name" --version-number "$version" --json | jq '[ .[] | select(.public) ] | length') # 0 if not exists
echo "$exists"