Skip to content

Add openapi-spec-updated receiver: regenerate the client when a new spec is published - #9

Draft
RichStone wants to merge 1 commit into
clickfunnels:mainfrom
RichStone:openapi-spec-sync-workflow
Draft

Add openapi-spec-updated receiver: regenerate the client when a new spec is published#9
RichStone wants to merge 1 commit into
clickfunnels:mainfrom
RichStone:openapi-spec-sync-workflow

Conversation

@RichStone

Copy link
Copy Markdown

Proposal to close the spec-to-client sync loop from the platform side.

The ClickFunnels platform publishes its OpenAPI spec at GET /api/v2/openapi.yaml and announces each new artifact to this repository with a repository_dispatch event of type openapi-spec-updated, carrying the spec's SHA-256 in client_payload.sha256 (the same value the endpoint returns in its X-OpenAPI-SHA256 response header). This PR adds the receiving workflow so those announcements turn into reviewable sync PRs here:

  1. fetch the published spec from the live API,
  2. verify it against the announced checksum (a mismatch usually means the fetch raced the deploy; re-run once it settles),
  3. make generate SPEC_SRC=... (the existing down-convert, normalize, oapi-codegen pipeline),
  4. make vet && make test && make build,
  5. open a draft PR with the regenerated internal/api/api.gen.go + cmd/operations.gen.go when they changed; exit quietly when already in sync (the codegen is deterministic, so the diff itself is the dedupe).

Nothing is pushed to main and nothing auto-merges; a human reviews every sync PR. workflow_dispatch is included for manual runs with an optional expected checksum.

Required repository configuration (values live only in Actions settings, never in the repo)

Name Kind Purpose
OPENAPI_SPEC_URL secret Full URL of the spec endpoint (<api base>/api/v2/openapi.yaml)
OPENAPI_SPEC_TOKEN secret An API bearer token authorized to read it

Draft on purpose: it needs those two values configured by a maintainer, plus a decision on who reviews the sync PRs, before the loop can be exercised end to end.

🤖 Generated with Claude Code

Turns the platform's repository_dispatch announcement of a newly published
OpenAPI spec into a reviewable draft PR: fetch the spec from the live API,
verify the announced SHA-256, run the existing make generate pipeline,
sanity-build, and open a draft PR only when the committed generated files
changed. Manual runs via workflow_dispatch. Requires OPENAPI_SPEC_URL and
OPENAPI_SPEC_TOKEN in the repository's Actions settings.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant