Skip to content

Commit

Permalink
fix: correct environment variable references
Browse files Browse the repository at this point in the history
  • Loading branch information
joshdk committed Feb 10, 2024
1 parent 2c43c39 commit 791d9ee
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ package main
import (
"fmt"
"os"
"strings"

"github.com/joshdk/actions-docker-shim/docker"
flag "github.com/spf13/pflag"
Expand All @@ -28,14 +29,16 @@ func mainCmd() error {
flag.Parse()

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

var token string
if value := os.Getenv("GITHUB_TOKEN"); value != "" {
// Environment variable named "GITHUB_TOKEN".
token = value
} else if value := os.Getenv("INPUT_GITHUB_TOKEN"); value != "" {
} else if value := os.Getenv("INPUT_GITHUB-TOKEN"); value != "" {
// Input named "github-token".
token = value
} else if value := os.Getenv("INPUT_TOKEN"); value != "" {
Expand Down

0 comments on commit 791d9ee

Please sign in to comment.