How the action works

This action is designed to propagate a Go version change across a repository after the source Docker image has already been updated.

Intended flow

The usual workflow is:

  1. Update a Dockerfile in the target repository so it uses a newer Go image, typically from the official golang Docker image.
  2. Run update-go-action and point it at that Dockerfile.
  3. The action reads the Go version from the Dockerfile.
  4. The action updates other files that mention the Go version, based on rules.json.
  5. If configured by a rule, the action runs go mod tidy or go work sync so Go module files stay consistent.

The action does not update the Dockerfile itself. It assumes the Dockerfile version change already happened and then synchronises the rest of the repository to match it.

Version source

The action extracts the version from the Docker image reference in the configured Dockerfile.

Today it matches image references like:

It derives two values from that image tag:

How replacements happen

Replacement logic is defined in rules.json.

Each rule tells the action:

Rules can use these placeholders inside replacement text:

This allows the action to update different file types correctly. For example:

Post-processing

When a rule has go_mod_tidy: true:

This happens after all text replacements have completed.

Commit behaviour

If any files changed and no-commit is not true, the action commits the updated files automatically.

If no-commit: true is set, the action still performs the updates but leaves the changes uncommitted.

The action operates on the branch checked out by actions/checkout. Select a target branch with its ref input. The action's branch input is deprecated and ignored, but remains accepted for v1 compatibility.

Private dependencies

If go mod tidy or go work sync needs access to private Go modules, provide:

When both inputs are set, the action:

If either input is missing, private dependency setup is skipped.

private-module-prefix defaults to github.com/Arm-Debug, so providing only token uses that prefix automatically.

For GitHub-hosted repositories, the rewritten URL uses the x-access-token HTTPS form documented by GitHub:

References: