Skip to content

Commit

Permalink
feat: flag to override image to pull (#10)
Browse files Browse the repository at this point in the history
  • Loading branch information
joshdk authored Feb 9, 2024
1 parent 4193316 commit 0144dc4
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
2 changes: 2 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
module github.com/joshdk/actions-docker-shim

go 1.21

require github.com/spf13/pflag v1.0.5
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
9 changes: 8 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"os"

"github.com/joshdk/actions-docker-shim/docker"
flag "github.com/spf13/pflag"
)

func main() {
Expand All @@ -22,7 +23,13 @@ func main() {

//nolint:forbidigo,wsl
func mainCmd() error {
image := fmt.Sprintf("ghcr.io/%s:%s", os.Getenv("GITHUB_REPOSITORY"), os.Getenv("GITHUB_ACTION_REF"))
var image string
flag.StringVar(&image, "image", "", "ghcr.io image to run")
flag.Parse()

if image == "" {
image = fmt.Sprintf("ghcr.io/%s:%s", os.Getenv("GITHUB_REPOSITORY"), os.Getenv("GITHUB_ACTION_REF"))
}

var token string
if value := os.Getenv("GITHUB_TOKEN"); value != "" {
Expand Down

0 comments on commit 0144dc4

Please sign in to comment.