Skip to content

[DEVREL-144] Automate daily OpenAPI sync (regenerate + open bot PR)#584

Merged
justinpolygon merged 1 commit into
masterfrom
justin/devrel-144
Jul 8, 2026
Merged

[DEVREL-144] Automate daily OpenAPI sync (regenerate + open bot PR)#584
justinpolygon merged 1 commit into
masterfrom
justin/devrel-144

Conversation

@justinpolygon

@justinpolygon justinpolygon commented Jul 8, 2026

Copy link
Copy Markdown
Collaborator

Replicates the live automated OpenAPI regeneration pipeline from client-jvm and client-js in client-go: track spec changes and open a brand-new [bot] PR with the regenerated client daily, hands-off, instead of the manual regeneration run today.

Linear: https://linear.app/massive-com/issue/DEVREL-144/automate-daily-openapi-sync-for-client-go-regenerate-open-bot-pr

Key difference from jvm/js

client-go generates via oapi-codegen (Go-native), not the Java openapi-generator. So there is no openapitools.json, no setup-java, no jar to cache. The Go-native equivalents:

  • Generator version pinned to oapi-codegen v2.5.1, invoked via go run <pkg>@<version> (single-sourced in scripts/generate.sh). This fixes the real latent break — the old rest/generation.sh called a bare oapi-codegen off PATH (unpinned).
  • CI toolchain: setup-go + setup-node (Node runs the spec pull + post-processing). jq is preinstalled on the runner.

Generated output is isolated in rest/gen/client.gen.go; hand-written rest/client.go, rest/iterator.go, and the entire websocket/ package are preserved by not being touched.

What's in this PR (pipeline only)

  • scripts/generate.sh — single orchestrator: pull spec → non-empty-spec gate → jq preprocess → pinned oapi-codegen → client-exists gate → fix-go-clashes.js + gofmt.
  • .github/workflows/sync-openapi.yml — daily schedule + workflow_dispatch; GitHub App token (create-github-app-token@v2), checkout persist-credentials, git diff --cached gate, GPG-signed commit as justinpolygon, unique bot/openapi-sync-<date>-<run_id> branch, brand-new [bot] PR every run, best-effort automated label, Slack notify. Tracked artifacts: rest/scripts/openapi.json + rest/gen/client.gen.go.
  • scripts/readme.md — maintainer docs + required secrets/vars.
  • README.md — automation explainer + "Developing & regenerating" section; fixed dead rest/example link.
  • Removed the superseded rest/generation.sh.

This setup PR is intentionally pipeline-only — I verified a full regen builds/tests cleanly (go build/vet/test ./...), then reverted the regenerated artifacts. The first workflow_dispatch after merge will produce the spec-sync [bot] PR and validate the automation end-to-end.

Add a daily GitHub Actions workflow that pulls the latest OpenAPI spec,
regenerates the REST client with oapi-codegen, and opens a brand-new [bot]
PR when the output differs from what's committed. Mirrors the automation in
client-jvm / client-js, adapted to the Go toolchain (oapi-codegen, not the
Java openapi-generator).

- scripts/generate.sh: single orchestrator (pull -> gate -> jq preprocess ->
  pinned oapi-codegen v2.5.1 via 'go run <pkg>@<ver>' -> gate -> fix clashes).
- .github/workflows/sync-openapi.yml: schedule + workflow_dispatch; GitHub App
  token, diff gate, GPG-signed bot commit, unique bot/openapi-sync-<date>-<run_id>
  branch, best-effort label, Slack notify.
- scripts/readme.md: maintainer docs + required secrets/vars.
- README.md: automation explainer + regenerate/build instructions; fix dead
  rest/example link.
- Remove superseded rest/generation.sh.

https://linear.app/massive-com/issue/DEVREL-144
@justinpolygon justinpolygon requested a review from a team as a code owner July 8, 2026 15:21
@justinpolygon justinpolygon merged commit fa5f995 into master Jul 8, 2026
9 checks passed
@justinpolygon justinpolygon deleted the justin/devrel-144 branch July 8, 2026 15:30
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.

2 participants