forked from botpress/botpress
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprod-master-version-verification.yml
More file actions
78 lines (67 loc) · 2.73 KB
/
Copy pathprod-master-version-verification.yml
File metadata and controls
78 lines (67 loc) · 2.73 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
name: Production version matches master
on:
schedule:
- cron: '0 8 * * 1-5'
workflow_dispatch: # optional manual trigger
jobs:
build:
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: Check integration versions
env:
SERVER_URL: ${{ github.server_url }}
REPO: ${{ github.repository }}
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WORKFLOW_SEAGULL_WEBHOOK_URL }}
run: |
SKIP_INTEGRATIONS=("chat" "docusign" "zendesk-messaging-hitl")
integrations=$(find integrations -mindepth 1 -maxdepth 1 -type d -print0 | xargs -0 -n1 basename | sort -u)
should_fail=0
outdated_integrations=""
skipped_integrations=""
for integration in $integrations; do
# Check if integration should be skipped
skip=0
for skip_integration in "${SKIP_INTEGRATIONS[@]}"; do
if [ "$integration" = "$skip_integration" ]; then
echo "Skipping $integration"
skip=1
skipped_integrations="$skipped_integrations> $integration\n"
break
fi
done
if [ $skip -eq 1 ]; then
continue
fi
echo "Checking $integration"
exists=$(.github/scripts/integration-exists.sh "$integration")
if [ "$exists" -eq 0 ]; then
echo "Integration $integration is not up to date. Please deploy the latest version of your integration."
should_fail=1
outdated_integrations="$outdated_integrations> $integration\n"
fi
done
if [ $should_fail -eq 1 ]; then
message="\n\nThe following integrations are out of date:\n$outdated_integrations"
message="$message\nThe following integrations were skipped:\n$skipped_integrations"
message="$message\nPlease run the deployment for the out-of-date integrations in ${SERVER_URL}/${REPO}"
echo -e "\n\nSending curl request to Slack webhook"
echo "Response:"
curl -X POST "$SLACK_WEBHOOK_URL" \
-H "Content-Type: application/json" \
-d '{
"key": "prod-master-version-verification",
"text": "'"$message"'"
}'
echo -e "\nCurl request sent"
echo -e "$message"
exit 1
fi