Skip to content

fix: v9 module path release workflow#559

Merged
gjtorikian merged 2 commits into
mainfrom
fix/v9-module-path-release-workflow
May 27, 2026
Merged

fix: v9 module path release workflow#559
gjtorikian merged 2 commits into
mainfrom
fix/v9-module-path-release-workflow

Conversation

@gjtorikian
Copy link
Copy Markdown
Contributor

This module bump did not occur because the release process had an error. In this PR, the module rename is being done ahead of some changelog work (in case the changelog process breaks, which is what happened last time).

Closes #557

@gjtorikian gjtorikian requested review from a team as code owners May 27, 2026 13:40
@gjtorikian gjtorikian requested review from mthadley and removed request for a team May 27, 2026 13:40
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented May 27, 2026

Greptile Summary

This PR manually migrates the module path from v8 to v9 across go.mod, README.md, and all test files, and fixes the release workflow by reordering steps so the Go module path migration runs before the changelog inlining step.

  • Workflow fix: The "Migrate Go module path" step is moved earlier in the job so it commits and pushes the go.mod/import rewrite even if the subsequent changelog step encounters an error — the root cause of the missed v9 migration last time.
  • Manual v8→v9 migration: go.mod module declaration, all *_test.go import paths, and README.md badge/install references are consistently updated to v9.

Confidence Score: 4/5

Safe to merge; the changes are a mechanical import-path rename plus a workflow step reorder with no logic changes to the migration script itself.

The module rename is straightforward and consistent across all files. The workflow change moves an identical block of shell earlier in the job, which is the intended fix. The migration step lacks set -euo pipefail unlike the changelog step below it, so a silent failure in grep or sed would leave the working tree unchanged and the step would exit 0 reporting no changes — but this is pre-existing code moved verbatim.

.github/workflows/release-please.yml deserves a second look to confirm the migration step's error-handling behaviour meets expectations for future major-version bumps.

Important Files Changed

Filename Overview
.github/workflows/release-please.yml Moves 'Migrate Go module path' step before 'Inline rich changelog fragments' so the module-path rewrite runs even when the changelog step fails; both steps are otherwise identical to their previous versions.
go.mod Module path bumped from v8 to v9; straightforward one-line change consistent with the rest of the PR.
README.md All four v8 import/badge references updated to v9; consistent with go.mod and test file changes.
actions_helper_test.go Import path updated from v8 to v9; representative of the identical change in all 34 other *_test.go files.

Sequence Diagram

sequenceDiagram
    participant RP as release-please
    participant WF as GitHub Actions
    participant Repo as Release PR Branch

    Note over WF: OLD order (broken)
    RP->>WF: Opens/updates release PR
    WF->>Repo: Checkout PR branch
    WF->>Repo: Inline changelog fragments (commit + push)
    Note over WF,Repo: If this step fails, module migration never runs
    WF->>Repo: Migrate module path v8 to v9 (commit + push)

    Note over WF: NEW order (this PR)
    RP->>WF: Opens/updates release PR
    WF->>Repo: Checkout PR branch
    WF->>Repo: Migrate module path vN to vN+1 (commit + push)
    Note over WF,Repo: Module migration committed before changelog step
    WF->>Repo: Inline changelog fragments (commit + push)
Loading

Reviews (1): Last reviewed commit: "ci: run Go module migration before chang..." | Re-trigger Greptile

Comment on lines +47 to +75
- name: Migrate Go module path for major version bump
if: steps.release.outputs.pr
run: |
CURRENT_MAJOR=$(grep -oP 'module github\.com/workos/workos-go/v\K[0-9]+' go.mod)
NEW_VERSION=$(jq -r '."."' .release-please-manifest.json)
NEW_MAJOR="${NEW_VERSION%%.*}"

if [ "$CURRENT_MAJOR" = "$NEW_MAJOR" ]; then
echo "No major version change ($CURRENT_MAJOR → $NEW_MAJOR), skipping"
exit 0
fi

echo "Major version bump detected: v$CURRENT_MAJOR → v$NEW_MAJOR"

sed -i "s|module github.com/workos/workos-go/v${CURRENT_MAJOR}|module github.com/workos/workos-go/v${NEW_MAJOR}|" go.mod
find . -name '*.go' -not -path './.git/*' -type f \
-exec sed -i "s|github.com/workos/workos-go/v${CURRENT_MAJOR}|github.com/workos/workos-go/v${NEW_MAJOR}|g" {} +
find . -name 'README.md' -not -path './.git/*' -type f \
-exec sed -i "s|workos-go/v${CURRENT_MAJOR}|workos-go/v${NEW_MAJOR}|g" {} +

git config user.name "workos-sdk-automation[bot]"
git config user.email "255426317+workos-sdk-automation[bot]@users.noreply.github.com"
git add -A
if git diff --staged --quiet; then
echo "No changes to commit"
else
git commit -m "chore: update go.mod and import paths for v${NEW_MAJOR}"
git push
fi
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.

P2 Silent no-op risk when grep returns empty

The CURRENT_MAJOR extraction on line 50 uses grep -oP with no fallback. If the regex matches nothing (e.g., the module path ever lacks a /vN suffix, or go.mod is temporarily in a state the pattern doesn't cover), CURRENT_MAJOR is silently set to an empty string. The comparison [ "" = "$NEW_MAJOR" ] then evaluates to false, so the sed commands run with v${CURRENT_MAJOR} expanding to just v — they match nothing, no files change, git diff --staged --quiet passes, and the step exits 0 reporting "No changes to commit" without the migration having run.

Adding set -euo pipefail at the top of the script would cause the step to fail loudly instead, and an explicit guard (if [ -z "$CURRENT_MAJOR" ]; then echo "::error::..."; exit 1; fi) would make the failure mode even clearer. This code is identical to what was present before the reorder, so it's a pre-existing gap — but now that this is the first step to commit, a silent skip here is harder to detect in the PR.

@gjtorikian gjtorikian changed the title Fix/v9 module path release workflow fix: v9 module path release workflow May 27, 2026
@gjtorikian gjtorikian merged commit b89d38d into main May 27, 2026
6 of 7 checks passed
@gjtorikian gjtorikian deleted the fix/v9-module-path-release-workflow branch May 27, 2026 13:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

9.0.0 Release - go.mod Module Bump

1 participant