Use openclaw token; drop admin basic auth; auto-register webhook
All checks were successful
Deploy to dev.bl.pixeldev.eu / deploy (push) Successful in 2s
All checks were successful
Deploy to dev.bl.pixeldev.eu / deploy (push) Successful in 2s
This commit is contained in:
parent
695ad3c9c6
commit
3d284f80bc
@ -40,17 +40,14 @@ jobs:
|
||||
SLUG="${{ github.event.repository.name }}"
|
||||
DIR="/opt/deployed/${SLUG}"
|
||||
|
||||
# Find entry point
|
||||
ENTRY=""
|
||||
for f in server.js index.js src/server.js src/index.js; do
|
||||
[ -f "$DIR/$f" ] && ENTRY="$DIR/$f" && break
|
||||
done
|
||||
[ -z "$ENTRY" ] && ENTRY=$(node -e "const p=require('$DIR/package.json'); console.log('$DIR/'+p.main)" 2>/dev/null)
|
||||
|
||||
# Allocate port (base 4000 + hash of slug)
|
||||
PORT=$((4000 + $(echo -n "$SLUG" | cksum | cut -d' ' -f1) % 1000))
|
||||
|
||||
# Start or restart
|
||||
pm2 delete "deploy-${SLUG}" 2>/dev/null || true
|
||||
PORT=$PORT pm2 start "$ENTRY" --name "deploy-${SLUG}"
|
||||
|
||||
@ -59,13 +56,28 @@ jobs:
|
||||
- name: Register with dev registry
|
||||
run: |
|
||||
SLUG="${{ github.event.repository.name }}"
|
||||
NAME="${{ github.event.repository.name }}"
|
||||
TYPE="${{ steps.detect.outputs.type }}"
|
||||
PORT="${{ steps.node.outputs.port }}"
|
||||
|
||||
curl -s -X POST https://dev.bl.pixeldev.eu/api/register \
|
||||
-H "Content-Type: application/json" \
|
||||
-u admin:blaetternd-helix-dribbble124 \
|
||||
-d "{\"name\":\"${NAME}\",\"slug\":\"${SLUG}\",\"type\":\"${TYPE}\",\"port\":\"${PORT}\"}"
|
||||
-d "{\"name\":\"${SLUG}\",\"slug\":\"${SLUG}\",\"type\":\"${TYPE}\",\"port\":\"${PORT}\"}"
|
||||
|
||||
echo "✅ Live at https://dev.bl.pixeldev.eu/${SLUG}/"
|
||||
|
||||
- name: Ensure webhook exists
|
||||
run: |
|
||||
REPO="${{ github.repository }}"
|
||||
# Check if openclaw webhook already registered
|
||||
EXISTS=$(curl -s -H "Authorization: token ${{ secrets.OC_TOKEN }}" \
|
||||
"http://127.0.0.1:3040/api/v1/repos/${REPO}/hooks" \
|
||||
| python3 -c "import sys,json; hooks=json.load(sys.stdin); print('yes' if any('3050/webhook' in str(h.get('config',{}).get('url','')) for h in hooks) else 'no')" 2>/dev/null)
|
||||
if [ "$EXISTS" != "yes" ]; then
|
||||
curl -s -H "Authorization: token ${{ secrets.OC_TOKEN }}" \
|
||||
-X POST "http://127.0.0.1:3040/api/v1/repos/${REPO}/hooks" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{"type":"gitea","config":{"url":"http://127.0.0.1:3050/webhook/gitea","content_type":"json","secret":"wh-bl-openclaw-2026"},"events":["issues","issue_comment"],"active":true}'
|
||||
echo "Webhook registered"
|
||||
else
|
||||
echo "Webhook already present"
|
||||
fi
|
||||
|
||||
Loading…
Reference in New Issue
Block a user