Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

feat(api): add GitHub webhook receiver for evented refresh#1317

Merged
jonnii merged 1 commit into
main from
jonnii/20260623025415/add-GitHub-webhook-receiver-for-evented-refresh
Jun 24, 2026
Merged

feat(api): add GitHub webhook receiver for evented refresh #1317
jonnii merged 1 commit into
main from
jonnii/20260623025415/add-GitHub-webhook-receiver-for-evented-refresh

Conversation

@jonnii

@jonnii jonnii commented Jun 23, 2026
edited
Loading

Copy link
Copy Markdown
Collaborator

🔒 This PR has been locked (consolidating). To unlock it, run st unlock.

POST /api/v1/webhooks/github turns a verified push into an immediate refresh of
the matching managed checkout, so server state tracks GitHub without waiting for
the next interval tick. The interval loop stays as a backstop.

  • The route bypasses the session/CSRF gate (GitHub carries neither) but stays
    rate-limited, mirroring how /config is mounted on the public mux. It is
    authenticated solely by the X-Hub-Signature-256 HMAC and fails closed (404)
    when STACKIT_GITHUB_WEBHOOK_SECRET is unset, so it is never an open trigger —
    the correct posture for local/dev servers GitHub cannot reach.
  • The handler acks immediately (202) and runs the mirror-fetch in the
    background, since a fetch can outlast GitHub's delivery timeout. Coalescing
    bursts is a follow-up.
  • The shared *reposync.Syncer is now built once in NewServer (guarding the
    typed-nil provider trap) and drives both the interval loop and the webhook,
    so on-demand refresh works even with the loop disabled. handlers depends on it
    only through a narrow RepoSyncer interface.

Stack

💡 Notice: This PR is part of a stack merge into branch stack-merge-stack-1782266218.

Auto-generated by Stackit


Merged via consolidation into #1326 by jonnii

POST /api/v1/webhooks/github turns a verified push into an immediate refresh of
the matching managed checkout, so server state tracks GitHub without waiting for
the next interval tick. The interval loop stays as a backstop.
- The route bypasses the session/CSRF gate (GitHub carries neither) but stays
 rate-limited, mirroring how /config is mounted on the public mux. It is
 authenticated solely by the X-Hub-Signature-256 HMAC and fails closed (404)
 when STACKIT_GITHUB_WEBHOOK_SECRET is unset, so it is never an open trigger —
 the correct posture for local/dev servers GitHub cannot reach.
- The handler acks immediately (202) and runs the mirror-fetch in the
 background, since a fetch can outlast GitHub's delivery timeout. Coalescing
 bursts is a follow-up.
- The shared *reposync.Syncer is now built once in NewServer (guarding the
 typed-nil provider trap) and drives both the interval loop and the webhook,
 so on-demand refresh works even with the loop disabled. handlers depends on it
 only through a narrow RepoSyncer interface.
This was referenced Jun 23, 2026
Base automatically changed from jonnii/20260623024903/add-GitHub-webhook-signature-push-parsing-helper to main June 24, 2026 02:00
@jonnii jonnii merged commit d817de5 into main Jun 24, 2026
7 of 12 checks passed
@jonnii jonnii deleted the jonnii/20260623025415/add-GitHub-webhook-receiver-for-evented-refresh branch June 24, 2026 02:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

1 participant

AltStyle によって変換されたページ (->オリジナル) /