From 04a1171889aac37ef3cdc4030cb13c0e13d33ab5 Mon Sep 17 00:00:00 2001 From: Josh Komoroske Date: Fri, 9 Feb 2024 21:39:31 -0500 Subject: [PATCH] feat: flag to specify github token username --- main.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/main.go b/main.go index 63f5d22..d2d8488 100644 --- a/main.go +++ b/main.go @@ -27,7 +27,9 @@ func mainCmd() error { var image string flag.StringVar(&image, "image", "", "ghcr.io image to run") var tokenEnv string - flag.StringVar(&tokenEnv, "token-env", "", "env var to use for ghcr.io token") + flag.StringVar(&tokenEnv, "token-env", "", "env var to use for github token") + var username string + flag.StringVar(&username, "username", os.Getenv("GITHUB_ACTOR"), "username for github token") flag.Parse() if image == "" { @@ -52,7 +54,7 @@ func mainCmd() error { } fmt.Printf("::group::%s\n", "Docker login") - err := docker.Login(os.Getenv("GITHUB_ACTOR"), token) + err := docker.Login(username, token) fmt.Println("::endgroup::") if err != nil { return err