Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Fix and validate Go bump workflow - #14347

Merged
williammartin merged 7 commits into
trunkfrom
williammartin-fix-agentic-workflow
Sep 5, 2026
Merged

Fix and validate Go bump workflow#14347
williammartin merged 7 commits into
trunkfrom
williammartin-fix-agentic-workflow

Conversation

@williammartin

@williammartin williammartin commented Sep 4, 2026

Copy link
Copy Markdown
Member

Failed workflow job: https://github.com/cli/cli/actions/runs/33832777604/job/100899080355

Description

The automated Go update stopped working when Go 1.27 was released. The workflow first installed the Go version already listed in go.mod (Go 1.26), then changed go.mod to require Go 1.27. When it ran go mod tidy, the command correctly refused to continue because the installed toolchain was too old.

This changes the update flow so it prepares and validates the complete upgrade before opening a pull request:

  1. Refuse to run when tracked changes are already staged or unstaged, protecting local dry runs from accidentally committing and discarding existing work.
  2. Ask setup-go for the latest stable release, then pass the exact installed version into the bump script. The script no longer resolves Go independently, so release propagation cannot make setup and the update target disagree.
  3. Install the latest golangci-lint release that can validate that Go version.
  4. Update go.mod, run go mod tidy, and apply any source migrations from go fix.
  5. Run the full test suite and linter. If either fails, restore the original clean worktree, remove the temporary branch, and stop without creating a pull request.
  6. If everything passes, commit all tracked changes and open the Go update pull request.

After go mod tidy normalizes the final Go directives, the generated pull request updates .github/workflows/lint.yml only when Go still differs from the starting state. It records the exact golangci-lint version used during validation, giving a new Go major a compatible linter while keeping normal pull request and trunk CI on a reproducible version pin. A newer linter or a temporarily redundant toolchain directive cannot create a linter-only pull request.

This pull request only changes the automation. Any Go 1.27 source migrations and the corresponding linter pin will be produced and reviewed together in the follow-up Go update pull request.

Authorship and follow-up

Who wrote this:

  • A human wrote it.
  • An agent wrote it under close human direction.
  • An agent wrote it independently, and no human has guided the implementation beyond the initial prompt.

Who answers review comments:

  • @williammartin will read and reply directly.
  • An agent will draft replies and @username will read them before they are posted.
  • Nobody has explicitly committed to replying.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: c2faaf54-9531-419e-a272-87d33b1ce488
Copilot AI balanced review requested due to automatic review settings September 4, 2026 14:13

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.

Copilot review overview

🟢 Approval recommended

The documented setup-go behavior and failed-job evidence confirm the focused change resolves the toolchain mismatch.

Review tier: Balanced
Findings: None

What changed in this PR

Updates the Go bump workflow to use the latest stable toolchain, preventing failures when advancing the go.mod directive.

Changes:

  • Replaces go-version-file with the supported stable alias.
File Description
.github/​workflows/​bump-go.yml Installs stable Go before running the bump script.

💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: c2faaf54-9531-419e-a272-87d33b1ce488
@williammartin williammartin changed the title Fix Go bump workflow toolchain Fix and validate Go bump workflow Sep 4, 2026
williammartin and others added 2 commits September 4, 2026 16:32
Co-authored-by: Copilot App <[email protected]>
Copilot-Session: c2faaf54-9531-419e-a272-87d33b1ce488
Co-authored-by: Copilot App <[email protected]>
Copilot-Session: c2faaf54-9531-419e-a272-87d33b1ce488

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.

Copilot review overview

🟡 Changes recommended

Broad staging can discard pre-existing tracked work during local dry runs.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review tier: Balanced
Findings: 1 High severity · 1 Medium severity

New issues introduced by this change (2)
Severity Finding
High severity .github/​workflows/​scripts/​bump-go.sh — 🛑 Requirement: Refuse dirty worktrees before staging every tracked change This script supports…
Medium severity .github/​workflows/​scripts/​bump-go.sh — 💭 Commentary: Give linter-only updates accurate PR metadata A new golangci-lint release now makes…

Comment thread .github/workflows/scripts/bump-go.sh
Comment thread .github/workflows/scripts/bump-go.sh
Co-authored-by: Copilot App <[email protected]>
Copilot-Session: c2faaf54-9531-419e-a272-87d33b1ce488

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.

Copilot review overview

🟡 Changes recommended

Toolchain resolution can still diverge, and failed local validation leaves generated edits behind.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review tier: Balanced
Findings: 2 Medium severity

New issues introduced by this change (2)
Severity Finding
Medium severity .github/​workflows/​bump-go.yml — 🛑 Requirement: Resolve and install the same Go release This uses setup-go's stable alias, which…
Medium severity .github/​workflows/​scripts/​bump-go.sh — 🛑 Requirement: Restore the original clean worktree when validation fails At this exit, the go.mod,…
Issues resolved since last review (2)
Severity Finding
Medium severity .github/​workflows/​scripts/​bump-go.sh — 💭 Commentary: Give linter-only updates accurate PR metadata A new golangci-lint release now makes… View resolved comment
High severity .github/​workflows/​scripts/​bump-go.sh — 🛑 Requirement: Refuse dirty worktrees before staging every tracked change This script supports… View resolved comment

Comment thread .github/workflows/bump-go.yml
Comment thread .github/workflows/scripts/bump-go.sh
Co-authored-by: Copilot App <[email protected]>
Copilot-Session: c2faaf54-9531-419e-a272-87d33b1ce488

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.

Copilot review overview

🔵 Needs a closer look

Temporary redundant toolchain changes can still produce a linter-only pull request.

Review tier: Balanced
Findings: None

Issues resolved since last review (2)
Severity Finding
Medium severity .github/​workflows/​scripts/​bump-go.sh — 🛑 Requirement: Restore the original clean worktree when validation fails At this exit, the go.mod,… View resolved comment
Medium severity .github/​workflows/​bump-go.yml — 🛑 Requirement: Resolve and install the same Go release This uses setup-go's stable alias, which… View resolved comment
Suppressed comments (1)

.github/workflows/scripts/bump-go.sh:116

  • 🛑 Requirement: Check the final Go state before moving the linter pin

When the stable release is an x.y.0 version and go.mod already contains go x.y.0 with no toolchain line, go mod edit temporarily adds the redundant toolchain, so this condition is true. The later go mod tidy removes that line again, but a newly available linter remains as the only diff and creates the linter-only PR this change is intended to prevent. Compare the current directives with the expected post-tidy state (empty toolchain for x.y.0), or defer this decision until after tidy.

if ! git diff --quiet -- "$GO_MOD"; then

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: c2faaf54-9531-419e-a272-87d33b1ce488

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.

Copilot review overview

🟢 Approval recommended

The workflow fix is complete and validated, with only a non-blocking maintainability concern.

Review tier: Balanced
Findings: None

Suppressed comments (1)

Previously missed (1) — in code that hasn't changed since the last review.

.github/workflows/scripts/bump-go.sh:122

  • 💭 Commentary: Scope the pin lookup to the golangci-lint step

This pattern counts every indented version: vX.Y.Z input in lint.yml, not specifically the golangci-lint-action input. Adding another action with a semantic-version input would make all future Go bumps abort, while a changed linter input format could let the substitution target the wrong step. Restrict both the count and replacement to the with block belonging to golangci/golangci-lint-action.

@williammartin
williammartin marked this pull request as ready for review September 5, 2026 13:50
@williammartin
williammartin requested a review from a team as a code owner September 5, 2026 13:50
@williammartin
williammartin merged commit 0d121e8 into trunk Sep 5, 2026
59 checks passed
@williammartin
williammartin deleted the williammartin-fix-agentic-workflow branch September 5, 2026 13:53
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