Skip to content

feat(ci): auto-open downstream bump PRs on package release#638

Open
SoulPancake wants to merge 5 commits into
mainfrom
feat/downstream-bump-prs
Open

feat(ci): auto-open downstream bump PRs on package release#638
SoulPancake wants to merge 5 commits into
mainfrom
feat/downstream-bump-prs

Conversation

@SoulPancake

@SoulPancake SoulPancake commented Jul 7, 2026

Copy link
Copy Markdown
Member

When a package release is published (undrafted) in this repo, open a version-bump PR against the relevant downstream consumers, authored and GPG-signed by the same openfga-releaser-bot identity used by release-please.

  • pkg/js -> openfga/vscode-ext (@openfga/syntax-transformer)
  • pkg/java -> openfga/intellij-plugin (dev.openfga:openfga-language)
  • pkg/go -> openfga/cli, openfga/terraform-provider-openfga

Adds scripts/downstream-bump.sh (per-ecosystem edit logic, idempotent) with unit tests, and reusable-downstream-bump.yaml which mints a target-scoped App token, applies the bump, and opens the PR. Chained after each finalize-release job so it is not subject to the GITHUB_TOKEN no-retrigger rule.

Description

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

  • New Features

    • Automated release updates now create pull requests for downstream Java, Go, and JavaScript projects.
    • Version updates cover relevant dependency files and lockfiles, with duplicate and no-change updates handled automatically.
  • Bug Fixes

    • Added validation and clear failure handling for unsupported ecosystems or missing dependency files.
  • Tests

    • Added coverage for version normalization, dependency updates, validation, and failure scenarios.
    • Release script tests now run for pull requests and relevant changes.

When a package release is published (undrafted) in this repo, open a
version-bump PR against the relevant downstream consumers, authored and
GPG-signed by the same openfga-releaser-bot identity used by release-please.

- pkg/js  -> openfga/vscode-ext (@openfga/syntax-transformer)
- pkg/java -> openfga/intellij-plugin (dev.openfga:openfga-language)
- pkg/go  -> openfga/cli, openfga/terraform-provider-openfga

Adds scripts/downstream-bump.sh (per-ecosystem edit logic, idempotent) with
unit tests, and reusable-downstream-bump.yaml which mints a target-scoped App
token, applies the bump, and opens the PR. Chained after each finalize-release
job so it is not subject to the GITHUB_TOKEN no-retrigger rule.
@coderabbitai

coderabbitai Bot commented Jul 7, 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: f9442b66-0740-48f4-8bf7-2a95333a539b

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

Changes

Downstream bump automation

Layer / File(s) Summary
Ecosystem bump script and validation
.github/workflows/scripts/downstream-bump.sh, .github/workflows/scripts/downstream-bump.test.sh, .github/workflows/test-release-scripts.yml
Adds version normalization and dependency updates for JavaScript, Java, and Go, with success and error-path shell tests executed in CI.
Reusable downstream PR workflow
.github/workflows/reusable-downstream-bump.yaml
Checks out repositories, configures credentials and toolchains, avoids duplicate or empty updates, and creates downstream bump pull requests.
Release workflow integration
.github/workflows/pkg-js-release.yaml, .github/workflows/pkg-java-release.yaml, .github/workflows/pkg-go-release.yaml
Triggers downstream bump jobs after tag releases are finalized for configured JavaScript, Java, and Go repositories.

Estimated code review effort: 3 (Moderate) | ~30 minutes

Sequence Diagram(s)

sequenceDiagram
  participant ReleaseWorkflow
  participant ReusableWorkflow
  participant DownstreamRepository
  participant BumpScript
  ReleaseWorkflow->>ReusableWorkflow: invoke after finalized tag release
  ReusableWorkflow->>DownstreamRepository: checkout target and prepare credentials
  ReusableWorkflow->>BumpScript: run ecosystem version bump
  BumpScript->>DownstreamRepository: update dependency files
  ReusableWorkflow->>DownstreamRepository: push branch and open pull request
Loading
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 16.67% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: CI now auto-opens downstream bump PRs when package releases are published.
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.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/downstream-bump-prs

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.

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 an automated “downstream consumer bump” flow that runs after publishing (undrafting) a package release, so downstream repos get version-bump PRs opened by the releaser bot identity.

Changes:

  • Introduces a reusable workflow to mint a target-scoped GitHub App token, apply an ecosystem-specific version bump, and open a signed PR in downstream repos.
  • Adds a downstream-bump.sh script plus a shell-based unit test suite, and wires those tests into CI.
  • Chains downstream bump jobs after the existing finalize-release jobs for JS/Java/Go package release workflows.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
.github/workflows/test-release-scripts.yml Runs the new downstream bump script tests in CI when scripts/workflow change.
.github/workflows/scripts/downstream-bump.sh Implements ecosystem-specific dependency bump logic for downstream repositories.
.github/workflows/scripts/downstream-bump.test.sh Adds hermetic/unit tests for downstream bump behaviors and guardrails.
.github/workflows/reusable-downstream-bump.yaml Reusable workflow that checks out target repo, applies bump, signs commit, and opens PR.
.github/workflows/pkg-js-release.yaml Invokes the downstream bump reusable workflow after JS release is published.
.github/workflows/pkg-java-release.yaml Invokes the downstream bump reusable workflow after Java release is published.
.github/workflows/pkg-go-release.yaml Invokes the downstream bump reusable workflow after Go release is published.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread .github/workflows/scripts/downstream-bump.sh Outdated
Comment thread .github/workflows/scripts/downstream-bump.sh Outdated
Comment thread .github/workflows/reusable-downstream-bump.yaml Outdated
Comment thread .github/workflows/reusable-downstream-bump.yaml Outdated
Comment thread .github/workflows/scripts/downstream-bump.test.sh
@SoulPancake
SoulPancake marked this pull request as ready for review July 16, 2026 09:19
@SoulPancake
SoulPancake requested review from a team as code owners July 16, 2026 09:19
@SoulPancake

Copy link
Copy Markdown
Member Author

Push based instead of waiting for dependabot

@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: 1

🧹 Nitpick comments (1)
.github/workflows/scripts/downstream-bump.test.sh (1)

5-8: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add hermetic success-path tests for JavaScript and Go.

Stub npm and go through a temporary PATH, then verify the normalized version, expected arguments, and resulting file changes. Currently, regressions in the two production success paths can pass CI because only their guards are exercised.

Also applies to: 150-197

🤖 Prompt for 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.

In @.github/workflows/scripts/downstream-bump.test.sh around lines 5 - 8, Add
hermetic success-path tests in downstream-bump.test.sh for the JavaScript and Go
update flows. Prepend temporary stub executables for npm and go to PATH, invoke
each flow, and assert version normalization, expected tool arguments, and the
resulting file changes while preserving the existing guard/error tests.
🤖 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/reusable-downstream-bump.yaml:
- Around line 68-75: Restrict the app token from the npm install performed by
the JS bump path: disable persisted checkout credentials in the checkout step,
stop exporting GH_TOKEN for Apply bump and open PR, and provide the generated
app token only to the git push/PR creation step that needs it. Preserve the
existing app-token generation and bump behavior while ensuring lifecycle scripts
cannot access the token.

---

Nitpick comments:
In @.github/workflows/scripts/downstream-bump.test.sh:
- Around line 5-8: Add hermetic success-path tests in downstream-bump.test.sh
for the JavaScript and Go update flows. Prepend temporary stub executables for
npm and go to PATH, invoke each flow, and assert version normalization, expected
tool arguments, and the resulting file changes while preserving the existing
guard/error tests.
🪄 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: 471e879e-0066-4282-9d63-705687d5cb9f

📥 Commits

Reviewing files that changed from the base of the PR and between 7e72164 and 7edfd39.

📒 Files selected for processing (7)
  • .github/workflows/pkg-go-release.yaml
  • .github/workflows/pkg-java-release.yaml
  • .github/workflows/pkg-js-release.yaml
  • .github/workflows/reusable-downstream-bump.yaml
  • .github/workflows/scripts/downstream-bump.sh
  • .github/workflows/scripts/downstream-bump.test.sh
  • .github/workflows/test-release-scripts.yml

Comment thread .github/workflows/reusable-downstream-bump.yaml
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