Skip to content

Commit 808410d

Browse files
Copilotasperpharma
andcommitted
Add URL validation and debugging to Lovable webhook workflows
Co-authored-by: asperpharma <252395498+asperpharma@users.noreply.github.com>
1 parent c65d6ec commit 808410d

2 files changed

Lines changed: 36 additions & 0 deletions

File tree

.github/workflows/sync-file-changes-to-lovable.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,24 @@ jobs:
2121
env:
2222
LOVABLE_WEBHOOK_URL: ${{ secrets.LOVABLE_WEBHOOK_URL }}
2323
run: |
24+
# Validate that LOVABLE_WEBHOOK_URL is set
25+
if [ -z "$LOVABLE_WEBHOOK_URL" ]; then
26+
echo "Error: LOVABLE_WEBHOOK_URL is not set"
27+
echo "Please set the LOVABLE_WEBHOOK_URL secret in the repository settings"
28+
exit 1
29+
fi
30+
31+
# Debug: Show masked URL (only show protocol and first few characters)
32+
MASKED_URL=$(echo "$LOVABLE_WEBHOOK_URL" | sed -E 's|(https?://[^/]{0,10}).*|\1...|')
33+
echo "LOVABLE_WEBHOOK_URL=$MASKED_URL"
34+
35+
# Validate URL format
36+
if ! echo "$LOVABLE_WEBHOOK_URL" | grep -qE '^https?://'; then
37+
echo "Error: LOVABLE_WEBHOOK_URL does not appear to be a valid URL"
38+
echo "Expected format: https://api.lovable.ai/... or similar"
39+
exit 1
40+
fi
41+
2442
echo "Gathering lists of changed files..."
2543
ADDED=$(jq -r '.commits[].added[]?' "$GITHUB_EVENT_PATH" | sort | uniq | jq -R . | jq -s .)
2644
MODIFIED=$(jq -r '.commits[].modified[]?' "$GITHUB_EVENT_PATH" | sort | uniq | jq -R . | jq -s .)

.github/workflows/sync-issues-prs-to-lovable.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,24 @@ jobs:
2323
env:
2424
LOVABLE_WEBHOOK_URL: ${{ secrets.LOVABLE_WEBHOOK_URL }}
2525
run: |
26+
# Validate that LOVABLE_WEBHOOK_URL is set
27+
if [ -z "$LOVABLE_WEBHOOK_URL" ]; then
28+
echo "Error: LOVABLE_WEBHOOK_URL is not set"
29+
echo "Please set the LOVABLE_WEBHOOK_URL secret in the repository settings"
30+
exit 1
31+
fi
32+
33+
# Debug: Show masked URL (only show protocol and first few characters)
34+
MASKED_URL=$(echo "$LOVABLE_WEBHOOK_URL" | sed -E 's|(https?://[^/]{0,10}).*|\1...|')
35+
echo "LOVABLE_WEBHOOK_URL=$MASKED_URL"
36+
37+
# Validate URL format
38+
if ! echo "$LOVABLE_WEBHOOK_URL" | grep -qE '^https?://'; then
39+
echo "Error: LOVABLE_WEBHOOK_URL does not appear to be a valid URL"
40+
echo "Expected format: https://api.lovable.ai/... or similar"
41+
exit 1
42+
fi
43+
2644
echo "Sending event to Lovable..."
2745
PAYLOAD=$(jq -n \
2846
--arg event_name "${{ github.event_name }}" \

0 commit comments

Comments
 (0)