Skip to content

Open a PR automatically when a native SDK releases - #3

Open
ianrumac wants to merge 2 commits into
mainfrom
ir/cool-thompson-kpjizz
Open

ianrumac wants to merge 2 commits into
mainfrom
ir/cool-thompson-kpjizz

Conversation

@ianrumac

@ianrumac ianrumac commented Oct 2, 2026 •

Copy link
Copy Markdown
Collaborator

Adds .github/workflows/native-sdk-bump.yml. It runs on the native-sdk-release repository_dispatch sent by Superwall-Android and Superwall-iOS. It can also be run by hand from the Actions tab (platform, an optional version where blank means latest, and dry_run), or called by another workflow through workflow_call.

What it does

  1. Checks the target. The version comes from the dispatch, or is the native repo's latest release. Only plain x.y.z versions are accepted. It does nothing if the pin is already at or above that version, or if a native-sdk/<platform>-<version> branch already exists.
  2. Bumps the version and opens a PR:
    • The Android pin in gradle/libs.versions.toml, or the iOS pin in both Package.swift and bridge/Package.swift. Only the exact: SuperwallKit pin is changed; the url/checksum lines stay owned by the release workflow.
    • A patch bump in version.env, but only if the current version is already tagged. Otherwise a release is staged and the entry joins it.
    • A CHANGELOG line.
    • The PR body includes the native CHANGELOG entries for every version between the old and new pin. This matters here, since KMP is on Android 2.8.0 and iOS 4.16.1.
  3. Runs the Pi agent on that PR, with the release notes and the native source checked out at the new tag (git diff old new for API changes). It follows .claude/CLAUDE.md and .agents/AGENTS.md: commonMain-only public API, explicitApi, and the bridge for iOS. It also updates the compileOnly pins in libs.versions.toml if superwall-android's own dependencies moved. On Android it checks with compileAndroidMain and testAndroidHostTest, then pushes onto the same PR. If nothing is needed, it explains why in the description. If the agent fails, the bump PR stays and gets a comment saying so.

Dry run: dry_run: true applies the bump and prints the diff and the full agent prompt. It pushes nothing, opens no PR and doesn't run the agent, so it's safe to try on main.

Setup

  • ANTHROPIC_API_KEY secret.
  • SDK_BOT_TOKEN secret (recommended): a PAT or App token with contents and pull-requests write. Without it the PR is made with GITHUB_TOKEN, which doesn't trigger ci.yml, and you need to enable "Allow GitHub Actions to create and approve pull requests".
  • Optional PI_MODEL repo variable.

Testing

  • actionlint and shellcheck pass.
  • Ran in dry-run mode with local-ci, which uses the real GitHub Actions runner, called through a throwaway workflow_call caller. Android 2.8.0 → 2.8.4: every step passed, with the pin bumped, the CHANGELOG entry added, all 2.8.1–2.8.4 release notes (including the handleLog background-thread breaking change) and the prompt built.
  • Earlier script-level runs also covered version.env 0.1.1 → 0.1.2 and an iOS 4.16.1 → 4.18.0 bump (both Package.swift pins, url/checksum untouched).
  • To make the workflow runnable under local-ci, values pass between steps through $GITHUB_ENV rather than step outputs (local-ci resolves step outputs to empty). The branch and tag checks also go through the GitHub API instead of git ls-remote, which local-ci stubs. Behaviour on GitHub is unchanged.
  • Not tested: PR creation and the agent run, which can only happen once this is on main. The runner is Linux, so the bridge and iOS klibs aren't built; the agent is told to say so, and CI on the PR covers it.

Counterparts: superwall/Superwall-Android#473, superwall/Superwall-iOS#538.

🤖 Generated with Claude Code

https://claude.ai/code/session_015S6mZpaJyu9J5v7NPv2WCS

claude added 2 commits October 2, 2026 13:04
Adds native-sdk-bump.yml, triggered by the native repos'
native-sdk-release repository_dispatch (or by hand). It bumps the pinned
native version and this SDK's version, opens a PR with the native release
notes for the whole skipped range, then runs the Pi coding agent on that
PR to implement any public API changes the release needs here.

Needs the ANTHROPIC_API_KEY secret; SDK_BOT_TOKEN is recommended so the
PR triggers CI.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015S6mZpaJyu9J5v7NPv2WCS
- dry_run input (workflow_dispatch and the new workflow_call trigger):
  applies the bump and prints the diff and agent prompt, without pushing,
  opening a PR or running the agent.
- Pass values between steps through $GITHUB_ENV instead of step outputs.
  Same behaviour on GitHub, and it drops the per-step env mapping blocks;
  local-ci resolves steps.*.outputs.* to empty strings.
- Check for an existing bump branch (and, in KMP, an existing release tag)
  through the GitHub API instead of git ls-remote, which local-ci stubs.
- Ignore file-mode changes when printing diffs.

Verified with local-ci in dry-run mode: KMP Android 2.8.0 -> 2.8.4,
Flutter iOS 4.16.3 -> 4.17.0 and Expo Android 2.8.3 -> 2.8.4 (pins lowered
locally to exercise the bump), plus the already-up-to-date skip path.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015S6mZpaJyu9J5v7NPv2WCS

ianrumac commented Oct 2, 2026

Copy link
Copy Markdown
Collaborator Author

CI: "Linux (common + Android + host tests)" fails, but not because of this PR. This PR only adds native-sdk-bump.yml and two scripts, none of which CI runs.

The job fails in Set up Android SDK (android-actions/setup-android@v3), before any Gradle step. The step's log shows Warning: Failed to find package 'tools', then sdkmanager exits with code 1. By default the action installs tools platform-tools, and the legacy tools package is no longer in Google's SDK repository. main will hit this on its next push too: its last CI run was cancelled, and the August runs before that passed. The macOS job passed on this PR.

No fix exists yet. Proposed patch for .github/workflows/ci.yml:

       - name: Set up Android SDK
         uses: android-actions/setup-android@v3
+        with:
+          packages: 'platform-tools'

I'd land that separately, or on this branch if you'd rather keep it together.


Generated by Claude Code

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