File tree Expand file tree Collapse file tree 1 file changed +15
-2
lines changed
Expand file tree Collapse file tree 1 file changed +15
-2
lines changed Original file line number Diff line number Diff line change 2323 WEBHOOK_URL="${{ secrets.WEBHOOK_URL }}"
2424 WEBHOOK_SECRET="${{ secrets.WEBHOOK_SECRET }}"
2525
26+ # Trim whitespace from secrets (GitHub secrets can have trailing newlines/spaces)
27+ WEBHOOK_URL=$(echo "$WEBHOOK_URL" | tr -d '\r\n' | xargs)
28+ WEBHOOK_SECRET=$(echo "$WEBHOOK_SECRET" | tr -d '\r\n' | xargs)
29+
2630 # Validate secrets are configured
2731 if [ -z "$WEBHOOK_URL" ]; then
2832 echo "Error: WEBHOOK_URL secret is not configured for $ENVIRONMENT environment"
3640 exit 1
3741 fi
3842
43+ # Validate URL format
44+ if [[ ! "$WEBHOOK_URL" =~ ^https?:// ]]; then
45+ echo "Error: WEBHOOK_URL must start with http:// or https://"
46+ echo "Current value starts with: ${WEBHOOK_URL:0:20}..."
47+ echo "Please check the URL format in: Repository Settings → Environments → $ENVIRONMENT → Secrets"
48+ exit 1
49+ fi
50+
3951 echo "Triggering deployment webhook for $ENVIRONMENT..."
40- echo "Webhook URL: $WEBHOOK_URL"
52+ echo "Webhook URL: ${ WEBHOOK_URL:0:30}..." # Show first 30 chars only for security
4153
4254 # Create payload
4355 PAYLOAD=$(cat <<EOF
5870 -H "X-Webhook-Secret: $WEBHOOK_SECRET" \
5971 -d "$PAYLOAD" \
6072 --fail --show-error \
61- -w "\nHTTP Status: %{http_code}\n"
73+ -w "\nHTTP Status: %{http_code}\n" \
74+ --max-time 30
6275
6376 echo "Deployment webhook triggered successfully for $ENVIRONMENT"
You can’t perform that action at this time.
0 commit comments