From 0485b164203e27c84ceb7440d0e3ba4910193e9b Mon Sep 17 00:00:00 2001 From: Ed Morley Date: Mon, 5 Oct 2026 15:42:39 +0100 Subject: [PATCH 1/3] Build the action images when `Dockerfile` or Go modules change The `action-*.yml` workflows only ran when an action's source or `internal/` changed, so changes to the `Dockerfile`, `go.mod`/`go.sum` (such as Dependabot's Go dependency PRs) or the workflow itself never test-built the images. Signed-off-by: Ed Morley --- .../workflows/action-buildpack-compute-metadata.yml | 8 ++++++++ .../action-buildpackage-verify-metadata.yml | 8 ++++++++ .github/workflows/action-registry-add-entry.yml | 8 ++++++++ .../workflows/action-registry-compute-metadata.yml | 8 ++++++++ .../workflows/action-registry-request-add-entry.yml | 8 ++++++++ .../workflows/action-registry-request-yank-entry.yml | 8 ++++++++ .../action-registry-verify-namespace-owner.yml | 8 ++++++++ .github/workflows/action-registry-yank-entry.yml | 12 ++++++++++-- 8 files changed, 66 insertions(+), 2 deletions(-) diff --git a/.github/workflows/action-buildpack-compute-metadata.yml b/.github/workflows/action-buildpack-compute-metadata.yml index 7d7c3cc..ff8e93f 100644 --- a/.github/workflows/action-buildpack-compute-metadata.yml +++ b/.github/workflows/action-buildpack-compute-metadata.yml @@ -2,14 +2,22 @@ name: Action buildpack-compute-metadata "on": pull_request: paths: + - .github/workflows/action-buildpack-compute-metadata.yml - buildpack/compute-metadata/** + - Dockerfile + - go.mod + - go.sum - internal/** push: branches: - main - test paths: + - .github/workflows/action-buildpack-compute-metadata.yml - buildpack/compute-metadata/** + - Dockerfile + - go.mod + - go.sum - internal/** release: types: diff --git a/.github/workflows/action-buildpackage-verify-metadata.yml b/.github/workflows/action-buildpackage-verify-metadata.yml index fdd77b0..6dd712f 100644 --- a/.github/workflows/action-buildpackage-verify-metadata.yml +++ b/.github/workflows/action-buildpackage-verify-metadata.yml @@ -2,14 +2,22 @@ name: Action buildpackage-verify-metadata "on": pull_request: paths: + - .github/workflows/action-buildpackage-verify-metadata.yml - buildpackage/verify-metadata/** + - Dockerfile + - go.mod + - go.sum - internal/** push: branches: - main - test paths: + - .github/workflows/action-buildpackage-verify-metadata.yml - buildpackage/verify-metadata/** + - Dockerfile + - go.mod + - go.sum - internal/** release: types: diff --git a/.github/workflows/action-registry-add-entry.yml b/.github/workflows/action-registry-add-entry.yml index 79fb9fe..6cab556 100644 --- a/.github/workflows/action-registry-add-entry.yml +++ b/.github/workflows/action-registry-add-entry.yml @@ -2,6 +2,10 @@ name: Action registry-add-entry "on": pull_request: paths: + - .github/workflows/action-registry-add-entry.yml + - Dockerfile + - go.mod + - go.sum - internal/** - registry/add-entry/** - registry/internal/** @@ -10,6 +14,10 @@ name: Action registry-add-entry - main - test paths: + - .github/workflows/action-registry-add-entry.yml + - Dockerfile + - go.mod + - go.sum - internal/** - registry/add-entry/** - registry/internal/** diff --git a/.github/workflows/action-registry-compute-metadata.yml b/.github/workflows/action-registry-compute-metadata.yml index 5232714..df03f2e 100644 --- a/.github/workflows/action-registry-compute-metadata.yml +++ b/.github/workflows/action-registry-compute-metadata.yml @@ -2,6 +2,10 @@ name: Action registry-compute-metadata "on": pull_request: paths: + - .github/workflows/action-registry-compute-metadata.yml + - Dockerfile + - go.mod + - go.sum - internal/** - registry/compute-metadata/** - registry/internal/** @@ -10,6 +14,10 @@ name: Action registry-compute-metadata - main - test paths: + - .github/workflows/action-registry-compute-metadata.yml + - Dockerfile + - go.mod + - go.sum - internal/** - registry/compute-metadata/** - registry/internal/** diff --git a/.github/workflows/action-registry-request-add-entry.yml b/.github/workflows/action-registry-request-add-entry.yml index 56d3c3d..0751e8b 100644 --- a/.github/workflows/action-registry-request-add-entry.yml +++ b/.github/workflows/action-registry-request-add-entry.yml @@ -2,6 +2,10 @@ name: Action registry-request-add-entry "on": pull_request: paths: + - .github/workflows/action-registry-request-add-entry.yml + - Dockerfile + - go.mod + - go.sum - internal/** - registry/internal/** - registry/request-add-entry/** @@ -10,6 +14,10 @@ name: Action registry-request-add-entry - main - test paths: + - .github/workflows/action-registry-request-add-entry.yml + - Dockerfile + - go.mod + - go.sum - internal/** - registry/internal/** - registry/request-add-entry/** diff --git a/.github/workflows/action-registry-request-yank-entry.yml b/.github/workflows/action-registry-request-yank-entry.yml index 43d0682..04ec94e 100644 --- a/.github/workflows/action-registry-request-yank-entry.yml +++ b/.github/workflows/action-registry-request-yank-entry.yml @@ -2,6 +2,10 @@ name: Action registry-request-yank-entry "on": pull_request: paths: + - .github/workflows/action-registry-request-yank-entry.yml + - Dockerfile + - go.mod + - go.sum - internal/** - registry/internal/** - registry/request-yank-entry/** @@ -10,6 +14,10 @@ name: Action registry-request-yank-entry - main - test paths: + - .github/workflows/action-registry-request-yank-entry.yml + - Dockerfile + - go.mod + - go.sum - internal/** - registry/internal/** - registry/request-yank-entry/** diff --git a/.github/workflows/action-registry-verify-namespace-owner.yml b/.github/workflows/action-registry-verify-namespace-owner.yml index bd936d1..28eb1ee 100644 --- a/.github/workflows/action-registry-verify-namespace-owner.yml +++ b/.github/workflows/action-registry-verify-namespace-owner.yml @@ -2,6 +2,10 @@ name: Action registry-verify-namespace-owner "on": pull_request: paths: + - .github/workflows/action-registry-verify-namespace-owner.yml + - Dockerfile + - go.mod + - go.sum - internal/** - registry/internal/** - registry/verify-namespace-owner/** @@ -10,6 +14,10 @@ name: Action registry-verify-namespace-owner - main - test paths: + - .github/workflows/action-registry-verify-namespace-owner.yml + - Dockerfile + - go.mod + - go.sum - internal/** - registry/internal/** - registry/verify-namespace-owner/** diff --git a/.github/workflows/action-registry-yank-entry.yml b/.github/workflows/action-registry-yank-entry.yml index 46df4ca..43ce26b 100644 --- a/.github/workflows/action-registry-yank-entry.yml +++ b/.github/workflows/action-registry-yank-entry.yml @@ -2,17 +2,25 @@ name: Action registry-yank-entry "on": pull_request: paths: + - .github/workflows/action-registry-yank-entry.yml + - Dockerfile + - go.mod + - go.sum - internal/** - - registry/yank-entry/** - registry/internal/** + - registry/yank-entry/** push: branches: - main - test paths: + - .github/workflows/action-registry-yank-entry.yml + - Dockerfile + - go.mod + - go.sum - internal/** - - registry/yank-entry/** - registry/internal/** + - registry/yank-entry/** release: types: - published From 81005ee50cd480d096fbe9ff5cde68ad1c76c681 Mon Sep 17 00:00:00 2001 From: Ed Morley Date: Mon, 5 Oct 2026 15:43:24 +0100 Subject: [PATCH 2/3] Derive the Go version from `go.mod` So the Go version only needs updating in one place. The `Dockerfile` now takes the major.minor of the `go` directive as a `GO_VERSION` build arg, and the unit tests pass it to `setup-go` with `check-latest`, so both use the latest patch release rather than the exact (and often outdated) patch version in the `go` directive. Signed-off-by: Ed Morley --- .github/workflows/action-buildpack-compute-metadata.yml | 1 + .github/workflows/action-buildpackage-verify-metadata.yml | 1 + .github/workflows/action-registry-add-entry.yml | 1 + .github/workflows/action-registry-compute-metadata.yml | 1 + .github/workflows/action-registry-request-add-entry.yml | 1 + .github/workflows/action-registry-request-yank-entry.yml | 1 + .../workflows/action-registry-verify-namespace-owner.yml | 1 + .github/workflows/action-registry-yank-entry.yml | 1 + .github/workflows/pb-tests.yml | 7 ++++++- Dockerfile | 4 +++- go.mod | 3 +++ 11 files changed, 20 insertions(+), 2 deletions(-) diff --git a/.github/workflows/action-buildpack-compute-metadata.yml b/.github/workflows/action-buildpack-compute-metadata.yml index ff8e93f..7cfe6fe 100644 --- a/.github/workflows/action-buildpack-compute-metadata.yml +++ b/.github/workflows/action-buildpack-compute-metadata.yml @@ -66,6 +66,7 @@ jobs: docker build \ --file Dockerfile \ --build-arg "SOURCE=${SOURCE}" \ + --build-arg "GO_VERSION=$(sed -nE 's/^go ([0-9]+\.[0-9]+).*/\1/p' go.mod)" \ --tag "${TARGET}:${VERSION}" \ . echo "::endgroup::" diff --git a/.github/workflows/action-buildpackage-verify-metadata.yml b/.github/workflows/action-buildpackage-verify-metadata.yml index 6dd712f..f582b18 100644 --- a/.github/workflows/action-buildpackage-verify-metadata.yml +++ b/.github/workflows/action-buildpackage-verify-metadata.yml @@ -66,6 +66,7 @@ jobs: docker build \ --file Dockerfile \ --build-arg "SOURCE=${SOURCE}" \ + --build-arg "GO_VERSION=$(sed -nE 's/^go ([0-9]+\.[0-9]+).*/\1/p' go.mod)" \ --tag "${TARGET}:${VERSION}" \ . echo "::endgroup::" diff --git a/.github/workflows/action-registry-add-entry.yml b/.github/workflows/action-registry-add-entry.yml index 6cab556..4717afd 100644 --- a/.github/workflows/action-registry-add-entry.yml +++ b/.github/workflows/action-registry-add-entry.yml @@ -68,6 +68,7 @@ jobs: docker build \ --file Dockerfile \ --build-arg "SOURCE=${SOURCE}" \ + --build-arg "GO_VERSION=$(sed -nE 's/^go ([0-9]+\.[0-9]+).*/\1/p' go.mod)" \ --tag "${TARGET}:${VERSION}" \ . echo "::endgroup::" diff --git a/.github/workflows/action-registry-compute-metadata.yml b/.github/workflows/action-registry-compute-metadata.yml index df03f2e..b3fb689 100644 --- a/.github/workflows/action-registry-compute-metadata.yml +++ b/.github/workflows/action-registry-compute-metadata.yml @@ -68,6 +68,7 @@ jobs: docker build \ --file Dockerfile \ --build-arg "SOURCE=${SOURCE}" \ + --build-arg "GO_VERSION=$(sed -nE 's/^go ([0-9]+\.[0-9]+).*/\1/p' go.mod)" \ --tag "${TARGET}:${VERSION}" \ . echo "::endgroup::" diff --git a/.github/workflows/action-registry-request-add-entry.yml b/.github/workflows/action-registry-request-add-entry.yml index 0751e8b..4cae491 100644 --- a/.github/workflows/action-registry-request-add-entry.yml +++ b/.github/workflows/action-registry-request-add-entry.yml @@ -68,6 +68,7 @@ jobs: docker build \ --file Dockerfile \ --build-arg "SOURCE=${SOURCE}" \ + --build-arg "GO_VERSION=$(sed -nE 's/^go ([0-9]+\.[0-9]+).*/\1/p' go.mod)" \ --tag "${TARGET}:${VERSION}" \ . echo "::endgroup::" diff --git a/.github/workflows/action-registry-request-yank-entry.yml b/.github/workflows/action-registry-request-yank-entry.yml index 04ec94e..6bd9b92 100644 --- a/.github/workflows/action-registry-request-yank-entry.yml +++ b/.github/workflows/action-registry-request-yank-entry.yml @@ -68,6 +68,7 @@ jobs: docker build \ --file Dockerfile \ --build-arg "SOURCE=${SOURCE}" \ + --build-arg "GO_VERSION=$(sed -nE 's/^go ([0-9]+\.[0-9]+).*/\1/p' go.mod)" \ --tag "${TARGET}:${VERSION}" \ . echo "::endgroup::" diff --git a/.github/workflows/action-registry-verify-namespace-owner.yml b/.github/workflows/action-registry-verify-namespace-owner.yml index 28eb1ee..6e07170 100644 --- a/.github/workflows/action-registry-verify-namespace-owner.yml +++ b/.github/workflows/action-registry-verify-namespace-owner.yml @@ -68,6 +68,7 @@ jobs: docker build \ --file Dockerfile \ --build-arg "SOURCE=${SOURCE}" \ + --build-arg "GO_VERSION=$(sed -nE 's/^go ([0-9]+\.[0-9]+).*/\1/p' go.mod)" \ --tag "${TARGET}:${VERSION}" \ . echo "::endgroup::" diff --git a/.github/workflows/action-registry-yank-entry.yml b/.github/workflows/action-registry-yank-entry.yml index 43ce26b..7b671bb 100644 --- a/.github/workflows/action-registry-yank-entry.yml +++ b/.github/workflows/action-registry-yank-entry.yml @@ -68,6 +68,7 @@ jobs: docker build \ --file Dockerfile \ --build-arg "SOURCE=${SOURCE}" \ + --build-arg "GO_VERSION=$(sed -nE 's/^go ([0-9]+\.[0-9]+).*/\1/p' go.mod)" \ --tag "${TARGET}:${VERSION}" \ . echo "::endgroup::" diff --git a/.github/workflows/pb-tests.yml b/.github/workflows/pb-tests.yml index f91f4cd..15c088f 100644 --- a/.github/workflows/pb-tests.yml +++ b/.github/workflows/pb-tests.yml @@ -21,9 +21,14 @@ jobs: key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} path: ${{ env.HOME }}/go/pkg/mod restore-keys: ${{ runner.os }}-go- + # Uses only the major.minor from `go.mod`, since setup-go would otherwise install the + # exact (and often outdated) patch version in the `go` directive, such as `1.27.0`. + - id: go-version + run: echo "version=$(sed -nE 's/^go ([0-9]+\.[0-9]+).*/\1/p' go.mod)" >> "${GITHUB_OUTPUT}" - uses: actions/setup-go@v7 with: - go-version: "1.26" + go-version: ${{ steps.go-version.outputs.version }} + check-latest: true - name: Install richgo run: | #!/usr/bin/env bash diff --git a/Dockerfile b/Dockerfile index 8f0ed3e..d3297e2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,6 @@ -FROM golang:1.26 as build-stage +# The major.minor of the `go` directive in `go.mod`, passed by the `action-*.yml` workflows. +ARG GO_VERSION +FROM golang:${GO_VERSION} as build-stage WORKDIR /src ENV GO111MODULE=on CGO_ENABLED=0 diff --git a/go.mod b/go.mod index 6cd49bc..00e8159 100644 --- a/go.mod +++ b/go.mod @@ -1,5 +1,8 @@ module github.com/buildpacks/github-actions +// This must use the full `1.N.0` form, since that's what Go's tooling (and so Dependabot) +// rewrites it to. The GitHub Actions workflows use only the major.minor from this line for +// `setup-go` and the `golang` image tag, so that they get the latest patch release. go 1.26.0 require ( From a3ba9033732a18d34ee9a12f5fb5d12aa0904e9d Mon Sep 17 00:00:00 2001 From: Ed Morley Date: Mon, 5 Oct 2026 15:43:25 +0100 Subject: [PATCH 3/3] Update to Go 1.27 Signed-off-by: Ed Morley --- go.mod | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/go.mod b/go.mod index 00e8159..e1e2533 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module github.com/buildpacks/github-actions // This must use the full `1.N.0` form, since that's what Go's tooling (and so Dependabot) // rewrites it to. The GitHub Actions workflows use only the major.minor from this line for // `setup-go` and the `golang` image tag, so that they get the latest patch release. -go 1.26.0 +go 1.27.0 require ( github.com/buildpacks/libcnb v1.30.4