name: Check Integration Versions on: pull_request permissions: id-token: write contents: read jobs: check-integration-versions: runs-on: ubuntu-latest timeout-minutes: 15 steps: - uses: actions/checkout@v2 - name: Setup uses: ./.github/actions/setup - name: Login to Botpress env: TOKEN: ${{ secrets.PRODUCTION_TOKEN_CLOUD_OPS_ACCOUNT }} WORKSPACE_ID: ${{ secrets.PRODUCTION_CLOUD_OPS_WORKSPACE_ID }} run: pnpm bp login -y --token "$TOKEN" --workspace-id "$WORKSPACE_ID" - name: Get changed files id: changed-files uses: tj-actions/changed-files@v46 with: files: 'integrations/**/*.{ts,md,svg,vrl}' separator: '\n' - name: Check integration versions env: CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }} run: | modified_integrations=$(echo -e "$CHANGED_FILES" | awk -F'/' '{print $2}' | sort -u) should_fail=0 SKIP_INTEGRATIONS=("chat") for integration in $modified_integrations; do skip=0 for skip_integration in "${SKIP_INTEGRATIONS[@]}"; do if [ "$integration" = "$skip_integration" ]; then echo "Skipping $integration" skip=1 break fi done if [ $skip -eq 1 ]; then continue fi echo "Checking $integration" exists=$(./.github/scripts/integration-exists.sh "$integration") if [ "$exists" -ne 0 ]; then echo "Integration $integration is already deployed publicly with the same version. Please update the version of your integration." should_fail=1 fi done if [ "$should_fail" -ne 0 ]; then echo "Please update the version of your integration before pushing your changes." exit 1 fi