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

This commit is contained in:
openclaw 2026-03-13 13:43:22 +00:00
parent 20b33e8055
commit ac6aa03788

View File

@ -40,33 +40,44 @@ 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 describe "deploy-${SLUG}" > /dev/null 2>&1 \
&& pm2 restart "deploy-${SLUG}" \
|| PORT=$PORT pm2 start "$ENTRY" --name "deploy-${SLUG}"
pm2 delete "deploy-${SLUG}" 2>/dev/null || true
PORT=$PORT pm2 start "$ENTRY" --name "deploy-${SLUG}"
echo "port=$PORT" >> $GITHUB_OUTPUT
- 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