Skip to content

feat(ci): add OfficeCLI bundled-version bump workflow - #571

Merged
Astro-Han merged 1 commit into
devfrom
slock/officecli-bump-workflow
May 12, 2026
Merged

feat(ci): add OfficeCLI bundled-version bump workflow#571
Astro-Han merged 1 commit into
devfrom
slock/officecli-bump-workflow

Conversation

@Astro-Han

@Astro-Han Astro-Han commented May 12, 2026

Copy link
Copy Markdown
Owner

Summary

Add a scheduled/manual GitHub workflow that checks iOfficeAI/OfficeCLI for a newer release, verifies the four bundled desktop assets with the existing prepare-officecli script, and opens a reviewable bump PR when the pinned version is behind.

Why

Today the desktop release workflow only consumes the version already pinned in packages/desktop-electron/bundled-tools.json. That is the right safety boundary for releases, but it leaves the repo without a first-class path to notice upstream OfficeCLI releases and prepare a version bump with verification attached.

This PR adds that missing upgrade workflow without changing release behavior:

  • release builds still consume the repo's pinned OfficeCLI version only
  • the new workflow only checks upstream, verifies checksums/assets, and opens a human-reviewed PR
  • if upstream assets or checksums drift, the workflow fails red instead of opening a partial bump PR

Related Issue

Closes #330.

Human Review Status

Pending. A human should make the final merge decision after reviewing the final diff and verification evidence.

Review Focus

  • The workflow should only update packages/desktop-electron/bundled-tools.json and should not touch the release workflow itself.
  • The verification step should cover all four bundled desktop targets before a PR is opened.
  • The workflow_dispatch path should support dry_run=true for safe manual validation without opening a PR.

Risk Notes

  • No product code, UI, or release workflow behavior changed.
  • The new workflow uses the existing prepare-officecli.ts contract for download + SHA256 verification, so version bumps stay aligned with the current release path.
  • GitHub cannot dispatch a brand-new workflow from a feature branch before that workflow exists on the default branch. I hit 404 workflow officecli-bump.yml not found on the default branch when trying to run gh workflow run officecli-bump.yml --ref slock/officecli-bump-workflow -f dry_run=true. To validate the same logic pre-merge, I ran the bump path locally against the live upstream release and restored the manifest afterward.

How To Verify

actionlint .github/workflows/officecli-bump.yml
Result: pass

bun --cwd packages/opencode test test/github/officecli-bump-workflow.test.ts
Result: 1 pass

bun --cwd packages/opencode typecheck
Result: pass

Local dry-run of workflow logic against live upstream latest release
Current pinned version: v1.0.63
Latest upstream release: v1.0.88
Verified targets:
- darwin-arm64
- darwin-x64
- win32-x64
- win32-arm64
Validation command: bun packages/desktop-electron/scripts/prepare-officecli.ts --platform <target-platform> --arch <target-arch>
Result: all 4 prepare-officecli runs passed from repo root, then bundled-tools.json restored to v1.0.63

Screenshots or Recordings

Not needed. This is a CI automation PR with no visible UI change.

Checklist

  • Human review status is stated above as pending, approved, or not required
  • I linked the related issue, or stated why there is no issue
  • This PR has type, primary area, and priority labels, or I requested maintainer labeling
  • I described the review focus and any meaningful risks
  • I listed the relevant verification steps and the key result for each
  • I did not introduce unrelated refactors, dependencies, generated files, or file changes beyond the stated scope
  • I manually checked visible UI or copy changes when needed, with screenshots or recordings
  • I considered macOS and Windows impact for platform, packaging, updater, signing, paths, shell, or permissions changes
  • I called out docs, release notes, dependencies, permissions, credentials, deletion behavior, generated content, or local file changes when relevant
  • I reviewed the final diff for unrelated changes and suspicious dependency changes
  • I am targeting dev, and my PR title and commit messages use Conventional Commits in English

Summary by CodeRabbit

  • New Features

    • Automated OfficeCLI version detection and update flow that opens a PR when a newer release is found
    • Supports scheduled weekly checks, manual triggering, and a dry-run mode; avoids creating duplicate PRs by detecting existing bump PRs
  • Tests

    • Added tests validating the OfficeCLI update workflow's configuration and behavior

Review Change Stack

@Astro-Han Astro-Han added enhancement New feature or request ci Continuous integration / GitHub Actions P2 Medium priority upstream Tracked upstream or vendor behavior labels May 12, 2026
@coderabbitai

coderabbitai Bot commented May 12, 2026

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 6f52db6f-2f00-4c24-aef9-6c1652723653

📥 Commits

Reviewing files that changed from the base of the PR and between 5e2096f and d2c0401.

📒 Files selected for processing (2)
  • .github/workflows/officecli-bump.yml
  • packages/opencode/test/github/officecli-bump-workflow.test.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • packages/opencode/test/github/officecli-bump-workflow.test.ts
  • .github/workflows/officecli-bump.yml

📝 Walkthrough

Walkthrough

Adds a new GitHub Actions workflow that checks iOfficeAI/OfficeCLI for a new release, compares it to the pinned version in packages/desktop-electron/bundled-tools.json, updates the manifest and verifies platform builds when different, and opens a bump PR to dev. Adds a Bun test validating the workflow file.

Changes

OfficeCLI Bump Automation

Layer / File(s) Summary
Workflow declaration and job setup
.github/workflows/officecli-bump.yml
Defines officecli-bump with workflow_dispatch (boolean dry_run) and a Monday 03:17 UTC schedule, repository write permissions, checkout, Node.js v24, and Bun installation.
Upstream version detection and comparison
.github/workflows/officecli-bump.yml
Installs deps, queries GitHub for iOfficeAI/OfficeCLI latest release, parses tag and URL, reads current pinned version from packages/desktop-electron/bundled-tools.json, exports current/latest outputs, and exits early if versions match.
Version bump and platform verification
.github/workflows/officecli-bump.yml
Rewrites the pinned OfficeCLI version in bundled-tools.json, runs bun ./scripts/prepare-officecli.ts to build/verify darwin/win32 across arm64/x64, and collects verified targets into workflow outputs.
PR creation and automation
.github/workflows/officecli-bump.yml
Computes bump branch/title, restricts non-dry runs to dev, checks for an existing open bump PR and exits if present, commits/pushes the bump branch, and creates a PR with an autogenerated body, labels, verified-targets, release URL, and "Closes #330." reference.
Workflow validation test suite
packages/opencode/test/github/officecli-bump-workflow.test.ts
Bun test loads the workflow file and asserts metadata (name, dispatch inputs), cron schedule, permissions, pinned uses versions for actions, checkout persist-credentials, and presence of key workflow script/command strings and markers.

Sequence Diagram

sequenceDiagram
  participant Runner as GitHub Runner
  participant GHAPI as GitHub API
  participant Repo as Repository
  participant Script as prepare-officecli.ts

  Runner->>GHAPI: Query iOfficeAI/OfficeCLI releases (latest)
  GHAPI-->>Runner: Latest tag + release URL
  Runner->>Repo: Read packages/desktop-electron/bundled-tools.json
  Runner->>Runner: Compare pinned vs latest
  alt pinned == latest
    Runner->>Runner: Exit early (no changes)
  else pinned != latest
    Runner->>Repo: Update bundled-tools.json to latest tag
    loop for each platform/arch (darwin/win32 x arm64/x64)
      Runner->>Script: Run prepare-officecli.ts for platform/arch
      Script-->>Runner: Verification result (success/failed)
    end
    Runner->>Repo: Commit & push bump branch
    Runner->>GHAPI: Create PR via gh cli with body, labels, and "Closes `#330`."
    GHAPI-->>Runner: PR created
  end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related issues

Possibly related PRs

  • Astro-Han/pawwork#331: Related work that added bundled-tools.json entries and prepare-officecli tooling used by this workflow.

Poem

🐰 I sniffed the tags at break of dawn,
Found a newer OfficeCLI to fawn,
Bumped the pin and ran each test,
Pushed a PR—let CI do the rest,
Hopping home with a job well-borne.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely summarizes the main change: adding an OfficeCLI bundled-version bump workflow to the CI pipeline.
Description check ✅ Passed The description is comprehensive and follows the template well, covering all major sections: summary, why, related issue, human review status, review focus, risk notes, verification steps, and checklist items completed.
Linked Issues check ✅ Passed The PR fully addresses issue #330 requirements: adds a scheduled/manual workflow to check upstream releases, verifies all four bundled desktop targets, updates the manifest only when verified, and preserves release-only pinned behavior.
Out of Scope Changes check ✅ Passed All changes are in-scope and directly support the linked objective: a new workflow file, a test file for that workflow, and no modifications to release logic or unrelated code.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch slock/officecli-bump-workflow

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.

@Astro-Han
Astro-Han force-pushed the slock/officecli-bump-workflow branch from c546e37 to 5e2096f Compare May 12, 2026 06:16

@Astro-Han Astro-Han left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Opus second-pass review — PR #571

Pass after P2 fix, no remaining blockers.

Strengths

  • Scope discipline: workflow modifies only packages/desktop-electron/bundled-tools.json, with an explicit branch guard if [ "$GITHUB_REF_NAME" != "dev" ]; then exit 1; fi for non-dry runs. Release workflow contract is unchanged.
  • dry_run defaults to true on workflow_dispatch. Safety-first default for a workflow that can open PRs.
  • Existing-PR check skips duplicate bumps cleanly (gh pr list --state open --base dev --head "$branch").
  • All four bundled desktop assets (darwin-arm64 / darwin-x64 / win32-x64 / win32-arm64) verified via the existing prepare-officecli script before opening the bump PR.
  • Failure path is fail-red, not fail-partial: upstream asset / checksum drift will fail the workflow rather than open a half-done bump.
  • All third-party actions pinned to commit SHA (actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd, actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e, oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6), no @v6 floating tags.
  • Contract test (packages/opencode/test/github/officecli-bump-workflow.test.ts) pins triggers, permissions, action SHAs, manifest path, and the bump command shape — protects against silent drift.
  • Local dry-run with v1.0.63 → v1.0.88 on all four targets attached as verification evidence.

P2 fix (already resolved at HEAD 5e2096fef)

The earlier HEAD had actions/checkout@v6 with persist-credentials: false paired with git push --set-upstream origin "$branch", which would have failed at first non-dry-run trigger because git had no auth wiring. Now fixed by calling gh auth setup-git before the push so GH_TOKEN configures the git remote.

The contract test also pins the gh auth setup-git line so this auth wiring cannot silently regress.

Nit (no action)

  • Schedule cron 17 3 * * 1 (03:17 UTC every Monday). Low-frequency cadence is fine. If upstream OfficeCLI ever produces pre-release tags, releases/latest would still skip them — acceptable for v1.

Verdict

Test-only / CI-workflow-only PR. No product code, no release workflow change, no UI/UX. Ready for engineering final from @GPT-X.

@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.

🧹 Nitpick comments (1)
.github/workflows/officecli-bump.yml (1)

68-70: 💤 Low value

Step name says "Exit" but does not terminate the workflow.

This step logs a message but does not stop execution. The correct behavior is achieved because subsequent steps have if conditions checking version mismatch, so they are skipped. Consider renaming to something like "Log when already up to date" to match actual behavior, or add an early exit 0 if you want to clearly end the run.

🤖 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/officecli-bump.yml around lines 68 - 70, The step named
"Exit when already up to date" is misleading because it only logs a message and
does not terminate the workflow; either rename the step to "Log when already up
to date" to reflect its actual behavior or change the step to explicitly
terminate the job by adding an exit (e.g., run: exit 0) so it truly stops
execution; update the step title and/or its run command where the step name
"Exit when already up to date" and the if condition checking
steps.versions.outputs.current_version == steps.versions.outputs.latest_version
appear.
🤖 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.

Nitpick comments:
In @.github/workflows/officecli-bump.yml:
- Around line 68-70: The step named "Exit when already up to date" is misleading
because it only logs a message and does not terminate the workflow; either
rename the step to "Log when already up to date" to reflect its actual behavior
or change the step to explicitly terminate the job by adding an exit (e.g., run:
exit 0) so it truly stops execution; update the step title and/or its run
command where the step name "Exit when already up to date" and the if condition
checking steps.versions.outputs.current_version ==
steps.versions.outputs.latest_version appear.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 2dff17e5-80d8-46a7-8dc3-41cf60933e47

📥 Commits

Reviewing files that changed from the base of the PR and between 6689b6a and c546e37.

📒 Files selected for processing (2)
  • .github/workflows/officecli-bump.yml
  • packages/opencode/test/github/officecli-bump-workflow.test.ts

@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.

🧹 Nitpick comments (1)
packages/opencode/test/github/officecli-bump-workflow.test.ts (1)

13-15: ⚡ Quick win

Harden step matching to avoid false positives with duplicate action steps.

Using find(...) only validates the first matching step. If a second actions/checkout/setup-node/setup-bun step is later added with an unpinned or different ref, this test may still pass. Prefer asserting exactly one matching step (or that all matches use the expected pinned ref).

Suggested tightening
-    const checkout = steps.find((step) => step.uses?.startsWith("actions/checkout@"))
-    const setupNode = steps.find((step) => step.uses?.startsWith("actions/setup-node@"))
-    const setupBun = steps.find((step) => step.uses?.startsWith("oven-sh/setup-bun@"))
+    const checkoutSteps = steps.filter((step) => step.uses?.startsWith("actions/checkout@"))
+    const setupNodeSteps = steps.filter((step) => step.uses?.startsWith("actions/setup-node@"))
+    const setupBunSteps = steps.filter((step) => step.uses?.startsWith("oven-sh/setup-bun@"))
+
+    expect(checkoutSteps).toHaveLength(1)
+    expect(setupNodeSteps).toHaveLength(1)
+    expect(setupBunSteps).toHaveLength(1)
+
+    const [checkout] = checkoutSteps
+    const [setupNode] = setupNodeSteps
+    const [setupBun] = setupBunSteps

Also applies to: 35-40

🤖 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 `@packages/opencode/test/github/officecli-bump-workflow.test.ts` around lines
13 - 15, The test currently uses steps.find(...) for checkout, setupNode, and
setupBun which only checks the first match and can mask duplicate/incorrect
steps; update the assertions to locate all matches (e.g., use steps.filter or
Array.prototype.reduce) for "actions/checkout", "actions/setup-node", and
"oven-sh/setup-bun" and assert there is exactly one match and that its uses
value equals the expected pinned ref (or assert all matches use the pinned ref)
for the variables checkout, setupNode, and setupBun to prevent false positives
from duplicate actions.
🤖 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.

Nitpick comments:
In `@packages/opencode/test/github/officecli-bump-workflow.test.ts`:
- Around line 13-15: The test currently uses steps.find(...) for checkout,
setupNode, and setupBun which only checks the first match and can mask
duplicate/incorrect steps; update the assertions to locate all matches (e.g.,
use steps.filter or Array.prototype.reduce) for "actions/checkout",
"actions/setup-node", and "oven-sh/setup-bun" and assert there is exactly one
match and that its uses value equals the expected pinned ref (or assert all
matches use the pinned ref) for the variables checkout, setupNode, and setupBun
to prevent false positives from duplicate actions.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: d56e143b-297a-4023-adf6-9486f6581592

📥 Commits

Reviewing files that changed from the base of the PR and between c546e37 and 5e2096f.

📒 Files selected for processing (2)
  • .github/workflows/officecli-bump.yml
  • packages/opencode/test/github/officecli-bump-workflow.test.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • .github/workflows/officecli-bump.yml

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a new test suite for the officecli-bump GitHub workflow to ensure correct triggers, permissions, and pinned action versions. A review comment points out that the versions specified for Node.js (24) and Bun (1.3.13) in the test expectations are likely incorrect as they refer to unreleased or non-existent versions, and suggests using stable versions like Node 22 and Bun 1.1.34 instead.

Comment thread packages/opencode/test/github/officecli-bump-workflow.test.ts
@Astro-Han
Astro-Han force-pushed the slock/officecli-bump-workflow branch from 5e2096f to d2c0401 Compare May 12, 2026 06:20
@Astro-Han
Astro-Han merged commit 422b515 into dev May 12, 2026
23 checks passed
@Astro-Han
Astro-Han deleted the slock/officecli-bump-workflow branch May 12, 2026 08:43
@coderabbitai coderabbitai Bot mentioned this pull request May 29, 2026
13 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci Continuous integration / GitHub Actions enhancement New feature or request P2 Medium priority upstream Tracked upstream or vendor behavior

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature] Add OfficeCLI bundled-version bump workflow

1 participant