Skip to content

GitHub Webhook - Reference ​

Full reference: DB-level source setup, native webhook, GitHub Actions fallback, signature testing, and all API responses.

How it works ​

  1. The API validates X-Hub-Signature-256 against the source webhook_secret.
  2. It finds the matching source row by repository.html_url.
  3. It finds all addons linked via addons.source_id.
  4. It downloads the repository at the configured ref.
  5. It replaces addon files and queues update jobs for all running instances.

Supported events: push, release, ping (health check only).

Step 1 - Link the addon source ​

Get the addon ID ​

List addons
bash
curl -sS "$BASE_URL/api/v1/instances/$INSTANCE_ID/addons" \
  -H "Authorization: Bearer $TOKEN" | jq
Run from platform/ directory
bash
docker compose exec -T platform-db psql -U platform -d platform <<'SQL'
-- Replace all placeholder values before running.
WITH upsert_source AS (
  INSERT INTO addon_sources (repo_url, ref, webhook_secret)
  VALUES (
    'https://github.com/<owner>/<repo>',
    'main',
    '<WEBHOOK_SECRET>'
  )
  ON CONFLICT DO NOTHING
  RETURNING id
), source_row AS (
  SELECT id FROM upsert_source
  UNION ALL
  SELECT id FROM addon_sources
  WHERE repo_url = 'https://github.com/<owner>/<repo>' LIMIT 1
)
UPDATE addons
SET source_id = (SELECT id FROM source_row)
WHERE id = '<ADDON_ID>'::uuid;
SQL

Note

repo_url must exactly match GitHub's repository.html_url - no .git suffix, case-sensitive.

Step 2 - Configure delivery ​

Go to Settings → Webhooks → Add webhook in the repository:

FieldValue
Payload URLhttps://panel.example.com/api/v1/webhooks/github
Content typeapplication/json
SecretThe WEBHOOK_SECRET from Step 1
EventsJust the push event (add release if needed)

Option B - GitHub Actions ​

Create .github/workflows/oaas-webhook.yml and add secrets OAAS_WEBHOOK_URL and OAAS_WEBHOOK_SECRET to the repository.

.github/workflows/oaas-webhook.yml
yaml
name: Trigger Addon Sync

on:
  push:
    branches: [main]
  release:
    types: [published]

jobs:
  notify:
    runs-on: ubuntu-latest
    steps:
      - name: Sign and send
        env:
          OAAS_WEBHOOK_URL: ${{ secrets.OAAS_WEBHOOK_URL }}
          OAAS_WEBHOOK_SECRET: ${{ secrets.OAAS_WEBHOOK_SECRET }}
          EVENT_NAME: ${{ github.event_name }}
        run: |
          set -euo pipefail
          body='{"repository":{"html_url":"${{ github.server_url }}/${{ github.repository }}"},"ref":"${{ github.ref }}","after":"${{ github.sha }}"}'
          sig="$(printf '%s' "$body" | openssl dgst -sha256 -hmac "$OAAS_WEBHOOK_SECRET" -hex | sed 's/^.* //')"
          event="push"; [ "$EVENT_NAME" = "release" ] && event="release"
          curl -sS -X POST "$OAAS_WEBHOOK_URL" \
            -H "Content-Type: application/json" \
            -H "X-GitHub-Event: $event" \
            -H "X-Hub-Signature-256: sha256=$sig" \
            --data "$body"

Testing ​

Send a signed test request
bash
BASE_URL="https://panel.example.com"
SECRET="<WEBHOOK_SECRET>"
BODY='{"repository":{"html_url":"https://github.com/<owner>/<repo>"}}'
SIG="$(printf '%s' "$BODY" | openssl dgst -sha256 -hmac "$SECRET" -hex | sed 's/^.* //')"

curl -i -X POST "$BASE_URL/api/v1/webhooks/github" \
  -H "Content-Type: application/json" \
  -H "X-GitHub-Event: push" \
  -H "X-Hub-Signature-256: sha256=$SIG" \
  --data "$BODY"

API responses ​

ResponseMeaning
{"status":"pong"}Ping accepted - endpoint is reachable.
{"status":"ignored"}Event type is not push or release.
{"status":"no_source_configured"}No source row matches the repository.html_url.
{"status":"no_addons_linked"}Source exists but no addon has source_id set.
{"error":"invalid signature"}HMAC secret mismatch.

Troubleshooting ​

ProblemFix
no_source_configuredrepo_url must match repository.html_url exactly - check trailing slashes and .git suffix.
invalid signatureThe webhook_secret in addon_sources doesn't match the signing secret. Update the DB row or regenerate.
no_addons_linkedSource row exists but addons.source_id was not set. Re-run the UPDATE query from Step 1.
Jobs not appearingInstance must be running and the addon must not be mid-install.