From 5624ebb7c9aff39e58294745a7ccf81baa04e314 Mon Sep 17 00:00:00 2001 From: Tony <1094086026@qq.com> Date: Fri, 22 May 2026 08:17:10 +0800 Subject: [PATCH] feat(platforms): fall back to ubuntu-latest image for ubuntu-slim runner GitHub Actions' ubuntu-slim runner (1-vCPU Linux runner, in public preview since 2025-10-28) uses the same base distro as ubuntu-latest, so act should resolve it to the same default image instead of printing 'Skipping unsupported platform'. Users can still override via -P ubuntu-slim=... like any other platform. Fixes #6003 --- cmd/platforms.go | 1 + cmd/platforms_test.go | 31 +++++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 cmd/platforms_test.go diff --git a/cmd/platforms.go b/cmd/platforms.go index 45724d752dc..aa8a42b7ef6 100644 --- a/cmd/platforms.go +++ b/cmd/platforms.go @@ -7,6 +7,7 @@ import ( func (i *Input) newPlatforms() map[string]string { platforms := map[string]string{ "ubuntu-latest": "node:16-buster-slim", + "ubuntu-slim": "node:16-buster-slim", "ubuntu-22.04": "node:16-bullseye-slim", "ubuntu-20.04": "node:16-buster-slim", "ubuntu-18.04": "node:16-buster-slim", diff --git a/cmd/platforms_test.go b/cmd/platforms_test.go new file mode 100644 index 00000000000..886518067f5 --- /dev/null +++ b/cmd/platforms_test.go @@ -0,0 +1,31 @@ +package cmd + +import ( + "testing" + + "github.com/stretchr/testify/assert" +) + +func TestNewPlatformsDefaults(t *testing.T) { + i := &Input{} + platforms := i.newPlatforms() + + // ubuntu-latest must be present and resolve to a default image + latest, ok := platforms["ubuntu-latest"] + assert.True(t, ok, "ubuntu-latest should be a default platform") + assert.NotEmpty(t, latest) + + // ubuntu-slim should fall back to the same image as ubuntu-latest + // (GitHub's 1-vCPU runner uses the same base distro, see issue #6003) + slim, ok := platforms["ubuntu-slim"] + assert.True(t, ok, "ubuntu-slim should be a default platform") + assert.Equal(t, latest, slim, "ubuntu-slim should default to the same image as ubuntu-latest") +} + +func TestNewPlatformsUserOverride(t *testing.T) { + i := &Input{platforms: []string{"ubuntu-slim=catthehacker/ubuntu:act-latest"}} + platforms := i.newPlatforms() + + assert.Equal(t, "catthehacker/ubuntu:act-latest", platforms["ubuntu-slim"], + "user-supplied -P value should override the default") +}