From 2e496704520ac57ed461c2e0238d95230b931d9f Mon Sep 17 00:00:00 2001 From: Lukasz Raczylo Date: Sat, 3 Oct 2026 21:48:33 +0100 Subject: [PATCH] feat(autoupdate): make go mod tidy optional Encore adds imports at build time, so go mod tidy prunes go.sum entries that the Encore build needs, and every batch failed with a missing go.sum entry. Add go-mod-tidy, on by default, so an Encore app can turn it off. --- .github/workflows/renovate-autoupdate.yaml | 9 ++++++++- README.md | 1 + 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/.github/workflows/renovate-autoupdate.yaml b/.github/workflows/renovate-autoupdate.yaml index ce9e212..0b59b21 100644 --- a/.github/workflows/renovate-autoupdate.yaml +++ b/.github/workflows/renovate-autoupdate.yaml @@ -28,6 +28,11 @@ on: required: false type: string default: "22" + go-mod-tidy: + description: "Run go mod tidy after a Go update. Turn it off for an Encore app: Encore adds imports at build time, so tidy prunes go.sum entries the build needs." + required: false + type: boolean + default: true go-prepare-command: description: "Shell commands to run before the Go tests, for example installing a CLI. To put a tool on PATH, append its directory to $GITHUB_PATH." required: false @@ -143,6 +148,7 @@ jobs: GO_DIR: ${{ inputs.go-working-directory }} NODE_DIR: ${{ inputs.node-working-directory }} PNPM_VERSION: ${{ inputs.pnpm-version }} + GO_MOD_TIDY: ${{ inputs.go-mod-tidy }} CONFIG_FILE: ${{ runner.temp }}/renovate-autoupdate-config.json run: | jq -n \ @@ -155,6 +161,7 @@ jobs: --arg go_dir "$GO_DIR" \ --arg node_dir "$NODE_DIR" \ --arg pnpm_version "$PNPM_VERSION" \ + --argjson go_tidy "$GO_MOD_TIDY" \ ' # A regex for files directly inside a directory, so only what the tests cover is updated. def prefix($d): (if $d == "." or $d == "" then "" else ($d | ltrimstr("./") | rtrimstr("/")) + "/" end) | gsub("\\."; "\\."); @@ -183,7 +190,7 @@ jobs: prHourlyLimit: 0, branchConcurrentLimit: 0, # A Go major update changes the import path: rewrite the imports, so the build tests the real update. - postUpdateOptions: ["gomodTidy", "gomodUpdateImportPaths"], + postUpdateOptions: ((if $go_tidy then ["gomodTidy"] else [] end) + ["gomodUpdateImportPaths"]), statusCheckNames: { artifactError: null, configValidation: null, diff --git a/README.md b/README.md index a36585b..815575d 100644 --- a/README.md +++ b/README.md @@ -179,6 +179,7 @@ The workflow finds `go.mod` and `package.json` itself and tests what exists. A r | `go-version` | `>=1.24` | Go version | | `go` | `true` | Update and test the Go module. Turn off for a repo with no Go code. | | `go-working-directory` | `.` | Directory that holds `go.mod`. Only this module is updated and tested. | +| `go-mod-tidy` | `true` | Run `go mod tidy` after a Go update. Turn it off for an Encore app, where tidy prunes `go.sum` entries the build needs. | | `go-prepare-command` | | Shell commands to run before the Go tests, for example installing a CLI. Append a tool directory to `$GITHUB_PATH` to put it on `PATH`. | | `go-test-command` | | Replaces the default `go build` and `go test`, for example `encore test ./...` for an Encore app. | | `node-version` | `22` | Node.js version |