Skip to content

Commit 230a6aa

Browse files
committed
docs: add SECRETS.md for LOVABLE_WEBHOOK_URL, simplify step 5
Made-with: Cursor
1 parent 7886925 commit 230a6aa

3 files changed

Lines changed: 259 additions & 53 deletions

File tree

.github/SECRETS.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Repository secrets (GitHub Actions)
2+
3+
Required **Actions** secrets so CI workflows run as intended.
4+
5+
## LOVABLE_WEBHOOK_URL (required for “Notify Lovable”)
6+
7+
The **Build and Push to Lovable** workflow (`build-and-push-to-lovable.yml`) runs a **Notify Lovable** step after each push to `main`. That step only runs when this secret is set; otherwise the deploy job is skipped.
8+
9+
**How to set it**
10+
11+
1. Open the repo on GitHub: **Settings → Secrets and variables → Actions**.
12+
2. Click **New repository secret**.
13+
3. Name: `LOVABLE_WEBHOOK_URL`.
14+
4. Value: the webhook URL from Lovable (file sync / deploy). Get it from your [Lovable project settings](https://lovable.dev/projects/657fb572-13a5-4a3e-bac9-184d39fdf7e6/settings) (or the Integrations / Webhooks section Lovable provides).
15+
5. Add the secret and save.
16+
17+
After this is set, the “Notify Lovable (push file changes for deploy)” step will run on each push to `main`.
18+
19+
---
20+
21+
Other workflows that use the same secret (and also skip when it’s empty):
22+
23+
- `sync-file-changes-to-lovable.yml`
24+
- `sync-issues-prs-to-lovable.yml`
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
# Build and Push to Lovable (Asper Beauty Shop)
2+
# Repo: asperpharma/understand-project
3+
# Live: https://asperbeautyshop-com.lovable.app
4+
#
5+
# On push to main (or manual run): build + test, then notify Lovable via webhook.
6+
# The "Notify Lovable" deploy job runs only when LOVABLE_WEBHOOK_URL is set.
7+
# Setup: see .github/SECRETS.md — add LOVABLE_WEBHOOK_URL in repo Actions secrets.
8+
9+
name: Build and Push to Lovable
10+
11+
on:
12+
push:
13+
branches: [main]
14+
workflow_dispatch:
15+
16+
env:
17+
AZURE_WEBAPP_PACKAGE_PATH: "."
18+
NODE_VERSION: "20.x"
19+
20+
permissions:
21+
contents: read
22+
23+
jobs:
24+
build:
25+
runs-on: ubuntu-latest
26+
steps:
27+
- name: Checkout
28+
uses: actions/checkout@v4
29+
30+
- name: Set up Node.js
31+
uses: actions/setup-node@v4
32+
with:
33+
node-version: ${{ env.NODE_VERSION }}
34+
cache: "npm"
35+
36+
- name: npm install, build, and test
37+
run: |
38+
npm ci
39+
npm run build --if-present
40+
npm run test --if-present
41+
42+
- name: Upload artifact for deployment job
43+
uses: actions/upload-artifact@v4
44+
with:
45+
name: node-app
46+
path: .
47+
48+
deploy:
49+
permissions:
50+
contents: none
51+
runs-on: ubuntu-latest
52+
needs: build
53+
if: secrets.LOVABLE_WEBHOOK_URL != ''
54+
environment:
55+
name: Development
56+
url: https://asperbeautyshop-com.lovable.app
57+
steps:
58+
- name: Download artifact from build job
59+
uses: actions/download-artifact@v4
60+
with:
61+
name: node-app
62+
63+
- name: Notify Lovable (push file changes for deploy)
64+
continue-on-error: true
65+
env:
66+
LOVABLE_WEBHOOK_URL: ${{ secrets.LOVABLE_WEBHOOK_URL }}
67+
run: |
68+
if [ "${{ github.event_name }}" = "push" ] && [ -f "$GITHUB_EVENT_PATH" ]; then
69+
ADDED=$(jq -r '.commits[].added[]?' "$GITHUB_EVENT_PATH" | sort | uniq | jq -R . | jq -s .)
70+
MODIFIED=$(jq -r '.commits[].modified[]?' "$GITHUB_EVENT_PATH" | sort | uniq | jq -R . | jq -s .)
71+
REMOVED=$(jq -r '.commits[].removed[]?' "$GITHUB_EVENT_PATH" | sort | uniq | jq -R . | jq -s .)
72+
else
73+
ADDED="[]"
74+
MODIFIED="[]"
75+
REMOVED="[]"
76+
fi
77+
COMPARE_URL="${{ github.event.compare }}"
78+
[ -z "$COMPARE_URL" ] && COMPARE_URL="https://github.com/${{ github.repository }}/commit/${{ github.sha }}"
79+
PAYLOAD=$(jq -n \
80+
--arg repo "${{ github.repository }}" \
81+
--arg commit "${{ github.sha }}" \
82+
--arg sender "${{ github.actor }}" \
83+
--arg url "$COMPARE_URL" \
84+
--argjson added "$ADDED" \
85+
--argjson modified "$MODIFIED" \
86+
--argjson removed "$REMOVED" \
87+
'{repo: $repo, commit: $commit, sender: $sender, compare_url: $url, added: $added, modified: $modified, removed: $removed}')
88+
echo "Sending to Lovable..."
89+
curl -s -f -X POST "$LOVABLE_WEBHOOK_URL" \
90+
-H "Content-Type: application/json" \
91+
-d "$PAYLOAD" || echo "Webhook call failed (non-fatal)."

0 commit comments

Comments
 (0)