mirror of
https://github.com/lukaszraczylo/shared-actions.git
synced 2026-10-11 04:47:01 +00:00
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.
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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 |
|
||||
|
||||
Reference in New Issue
Block a user