Skip to content

Automate Go version updates via scheduled workflow#21324

Merged
owen-mc merged 11 commits into
mainfrom
copilot/automate-go-version-updates-again
Jun 6, 2026
Merged

Automate Go version updates via scheduled workflow#21324
owen-mc merged 11 commits into
mainfrom
copilot/automate-go-version-updates-again

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Feb 13, 2026

Manual Go version updates require tracking releases and updating multiple files with different version format requirements. This workflow automates the process.

Implementation

Workflow: .github/workflows/go-version-update.yml

  • Queries go.dev/dl/?mode=json for latest release
  • Compares against MODULE.bazel version (full version including patch number)
  • Updates on version mismatch:
    • MODULE.bazelgo_sdk.download(version = "1.26.0")
    • go/extractor/go.modgo 1.26 and toolchain go1.26.0
    • go/extractor/autobuilder/build-environment.gomaxGoVersion = "1.26"
    • go/actions/test/action.ymldefault: "~1.26.0"
  • Creates/updates PR on workflow/go-version-update branch
  • Schedule: Weekly on Mondays at 3 AM UTC

Excluded from automation:

  • go/ql/** - Query-specific code requiring manual review
  • docs/** - Documentation requiring manual updates

Technical Details

  • Uses sed -E for cross-platform regex compatibility (GNU/BSD)
  • Escapes version strings for safe regex patterns
  • Validates API responses and version extraction
  • Deduplicates PRs via branch check
  • Fails fast on malformed data
  • Compares full semantic versions including patch numbers (e.g., 1.26.0 vs 1.26.4)

Example

When Go 1.27.0 releases:

Current: 1.26.0 → Latest: 1.27.0
Updates 4 files → Commits to workflow/go-version-update → Creates PR "Go: Update to 1.27.0"

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 5 commits February 13, 2026 11:17
Co-authored-by: mbg <278086+mbg@users.noreply.github.com>
Co-authored-by: mbg <278086+mbg@users.noreply.github.com>
Co-authored-by: mbg <278086+mbg@users.noreply.github.com>
Co-authored-by: mbg <278086+mbg@users.noreply.github.com>
Co-authored-by: mbg <278086+mbg@users.noreply.github.com>
Copilot AI changed the title [WIP] Add automation for Go version updates using GitHub Actions Automate Go version updates via scheduled workflow Feb 13, 2026
Copilot AI requested a review from mbg February 13, 2026 11:27
@owen-mc
Copy link
Copy Markdown
Contributor

owen-mc commented Jun 6, 2026

@copilot This only looks at major.minor, but actually we really care about the patch number as well. Please update it. Note that LATEST_GO_VERSION is in the format "go1.26.4" and CURRENT_VERSION is in the format "1.26.0". You could strip the "go" prefix from the first one before you compare them, for example.

Copy link
Copy Markdown
Contributor Author

Copilot AI commented Jun 6, 2026

@copilot This only looks at major.minor, but actually we really care about the patch number as well. Please update it. Note that LATEST_GO_VERSION is in the format "go1.26.4" and CURRENT_VERSION i...

Updated the workflow to use full version numbers (including patch) in commit messages, PR title, and PR body. The version comparison was already correctly comparing full versions including patch numbers (line 76), but the messages were only showing major.minor. Fixed in commit ef29d22.

Copilot AI requested a review from owen-mc June 6, 2026 01:04
@owen-mc owen-mc force-pushed the copilot/automate-go-version-updates-again branch from 93f8f59 to 6b74874 Compare June 6, 2026 01:33
@owen-mc owen-mc mentioned this pull request Jun 6, 2026
@owen-mc owen-mc marked this pull request as ready for review June 6, 2026 01:34
@owen-mc owen-mc requested a review from a team as a code owner June 6, 2026 01:34
Copilot AI review requested due to automatic review settings June 6, 2026 01:34
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds a scheduled GitHub Actions workflow to automatically detect the latest Go release and, when it differs from the repo’s pinned version, update the relevant version pins and open/update a PR on a dedicated branch.

Changes:

  • Introduces a weekly + manual-trigger workflow to fetch the latest Go version from go.dev/dl/?mode=json and compare it to MODULE.bazel.
  • Automatically edits the Go version in MODULE.bazel, go/extractor/go.mod, go/extractor/autobuilder/build-environment.go, and go/actions/test/action.yml.
  • Creates or updates a PR from workflow/go-version-update with the changes.
Show a summary per file
File Description
.github/workflows/go-version-update.yml Adds the automation that fetches Go versions, applies updates across multiple files, and opens/updates a PR on a scheduled cadence.

Copilot's findings

  • Files reviewed: 1/1 changed files
  • Comments generated: 4

Comment thread .github/workflows/go-version-update.yml
Comment thread .github/workflows/go-version-update.yml
Comment thread .github/workflows/go-version-update.yml
Comment thread .github/workflows/go-version-update.yml Outdated
owen-mc and others added 2 commits June 6, 2026 02:51
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
I checked and the comment seems to be correct.

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

@owen-mc owen-mc left a comment

Choose a reason for hiding this comment

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

I did a trial run here and it produced this PR, which seemed correct. I have made a few small tweaks since then, but nothing that requires re-running the trial, I think.

@owen-mc owen-mc merged commit cf6d94c into main Jun 6, 2026
6 checks passed
@owen-mc owen-mc deleted the copilot/automate-go-version-updates-again branch June 6, 2026 02:03
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.

4 participants