Skip to content

chore: generator to sdk sync workflow#709

Merged
SoulPancake merged 4 commits into
mainfrom
chore/syncjob-with-sdks
Jun 19, 2026
Merged

chore: generator to sdk sync workflow#709
SoulPancake merged 4 commits into
mainfrom
chore/syncjob-with-sdks

Conversation

@SoulPancake

@SoulPancake SoulPancake commented Jun 10, 2026

Copy link
Copy Markdown
Member

Description

Add SDK sync workflow

Adds .github/workflows/sync-sdks.yaml, which keeps the SDK repos in sync with the generator. Whenever generator inputs change on main, each SDK is regenerated and any resulting drift is raised as a PR in the SDK's own repo.

Triggers

  • Push to main touching config/**, scripts/**, docker/**, or Makefile (workflow files don't trigger it)
  • Manual dispatch with an sdk dropdown (all, js, go, dotnet, python, java)

Flow

  1. prepare computes the SDK matrix (all SDKs on push, the selected one on dispatch)
  2. For each SDK: check out the generator + the SDK repo's main, then run make test-client-<lang>
  3. If build or tests fail, the job stops; no PR is ever created from a failing run
  4. If the regenerated output matches the SDK repo, exit clean
  5. Otherwise: sign with the releaser bot's GPG key, force-push the diff to a sync/sdk-generator branch in the SDK repo, and open a PR titled chore(sync): sync with generator
  6. If a sync PR is already open, the branch is force-pushed with the fresh state, the body is updated, and a comment is posted so reviewers know to re-review; no duplicate PRs
  7. PRs get a sync-with-generator label for tracking (best-effort)

Auth

Uses the same GitHub App (RELEASER_APP_CLIENT_ID / RELEASER_APP_PRIVATE_KEY) and GPG key (GPG_PRIVATE_KEY / GPG_PASSPHRASE) as release-please, so PRs and commits show up as the releaser bot. The app token is minted per-SDK with access scoped to that repo only, and only after the build, since installation tokens expire after an hour.

What problem is being solved?

How is it being solved?

What changes are made to solve it?

References

Review Checklist

  • I have clicked on "allow edits by maintainers".
  • I have added documentation for new/changed functionality in this PR or in a PR to openfga.dev [Provide a link to any relevant PRs in the references section above]
  • The correct base branch is being used, if not main
  • I have added tests to validate that the change in functionality is working as expected

Summary by CodeRabbit

  • Chores
    • Added automated workflow to synchronize language-specific SDK repositories with the shared generator, ensuring consistent SDK updates across all languages.

Copilot AI review requested due to automatic review settings June 10, 2026 05:49
@SoulPancake SoulPancake requested a review from a team as a code owner June 10, 2026 05:49
@coderabbitai

coderabbitai Bot commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 473f293e-665b-444c-9e48-8d9feb820476

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Walkthrough

This pull request introduces a new GitHub Actions workflow that automatically regenerates SDKs whenever generator configuration, scripts, Docker setup, or build targets change. The workflow computes a language/repository matrix, checks out both the generator and target SDK repositories, runs language-specific regeneration via make, detects changes, commits and pushes to a sync branch with signed credentials, and creates or updates pull requests with links to the generator run.

Changes

SDK Synchronization Workflow

Layer / File(s) Summary
Workflow triggers and configuration
.github/workflows/sync-sdks.yaml
Defines push and manual dispatch triggers with path filters, sets repository read permissions, enables concurrency with run cancellation, and establishes shared environment variables for the sync branch name, PR title, and applied label.
SDK matrix preparation
.github/workflows/sync-sdks.yaml
Prepare job computes a dynamic SDK language/repository matrix using embedded JSON and jq filtering, supporting both full regeneration and single-language filtering via optional workflow dispatch input.
SDK checkout and regeneration
.github/workflows/sync-sdks.yaml
Sync job iterates the matrix, checks out both the generator source and target SDK repositories with non-persisted credentials, conditionally installs Python or JDK, configures Docker Buildx, executes the language-specific make target to regenerate and test SDKs, and computes a dirty flag to detect changes.
Git authentication and commit operations
.github/workflows/sync-sdks.yaml
When changes are detected, mints a GitHub App token for authenticated pushes, imports a GPG signing key, commits regenerated output to a fixed sync branch with run metadata, and force-pushes using signed commits.
Pull request creation and workflow summary
.github/workflows/sync-sdks.yaml
Uses GitHub CLI to create a new pull request from the sync branch or update an existing one with links to the generator commit and workflow run; applies a sync label in best-effort mode and outputs a summary indicating whether drift was detected for each SDK.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Suggested reviewers

  • rhamzeh
  • ewanharris
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: adding a GitHub Actions workflow to sync SDKs with the generator. It directly relates to the primary purpose of the changeset.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chore/syncjob-with-sdks

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a GitHub Actions workflow that regenerates each downstream SDK repo when sdk-generator inputs change on main, and opens/updates a “sync with generator” PR in the affected SDK repository when drift is detected.

Changes:

  • Introduces .github/workflows/sync-sdks.yaml to compute an SDK matrix (all on push; selected SDK on manual dispatch).
  • For each SDK, checks out the SDK repo, runs make test-client-<lang>, and detects whether regeneration produced changes.
  • If drift exists, signs and force-pushes a sync/sdk-generator branch and creates/updates a PR (with best-effort labeling/commenting).

Comment thread .github/workflows/sync-sdks.yaml
Comment thread .github/workflows/sync-sdks.yaml Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/sync-sdks.yaml:
- Around line 10-14: Add the OpenAPI spec to the push trigger paths so SDK
regeneration runs on spec-only changes: update the workflow's paths list (the
existing "paths:" block containing "config/**", "scripts/**", "docker/**",
"Makefile") to include the OpenAPI spec file
"docs/openapi/openfga.openapiv2.json" (or the containing directory
"docs/openapi/**") so make test-client-* will be triggered when the spec
changes.
- Around line 223-230: The Summary step currently runs under always() and only
checks steps.diff.outputs.dirty, which can print misleading messages after
earlier failures; modify the Summary step (named "Summary") to export the job
status into the run (e.g., add env: JOB_STATUS: ${{ job.status }}) and in the
run script first check if [ "$JOB_STATUS" != "success" ] and if so print a
failure/skip summary (or nothing) and exit non-zero or return, otherwise proceed
to inspect steps.diff.outputs.dirty and print the existing "drift detected" /
"in sync" messages; ensure you reference steps.diff.outputs.dirty unchanged and
only emit the sync messages when JOB_STATUS == "success".
- Around line 15-27: The workflow currently exposes workflow_dispatch with the
sdk input and needs a ref guard so manual runs only act on main; update the
workflow so all jobs that perform the sync (those triggered by
workflow_dispatch) include an if condition checking github.ref ==
'refs/heads/main' (or add a single top-level job that gates execution with if:
github.ref == 'refs/heads/main'), referencing the existing workflow_dispatch
trigger and sdk input, to prevent runs from non-main branches from executing the
sync steps.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 426ddf7c-1fac-49d3-b004-33f8d372d4a3

📥 Commits

Reviewing files that changed from the base of the PR and between e2197d0 and 0ab4f03.

📒 Files selected for processing (1)
  • .github/workflows/sync-sdks.yaml

Comment thread .github/workflows/sync-sdks.yaml
Comment thread .github/workflows/sync-sdks.yaml
Comment thread .github/workflows/sync-sdks.yaml
@SoulPancake SoulPancake requested review from rhamzeh June 13, 2026 17:44
@SoulPancake SoulPancake added this pull request to the merge queue Jun 19, 2026
Merged via the queue into main with commit 928b0de Jun 19, 2026
12 of 15 checks passed
@SoulPancake SoulPancake deleted the chore/syncjob-with-sdks branch June 19, 2026 15:04
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.

3 participants