mirror of
https://gitea.com/gitea/act_runner.git
synced 2026-03-22 06:45:03 +01:00
Use gh auth token for default GITHUB_TOKEN secret (#43)
* initial version
This commit is contained in:
10
cmd/root.go
10
cmd/root.go
@@ -29,6 +29,7 @@ import (
|
||||
"github.com/actions-oss/act-cli/pkg/artifacts"
|
||||
"github.com/actions-oss/act-cli/pkg/common"
|
||||
"github.com/actions-oss/act-cli/pkg/container"
|
||||
"github.com/actions-oss/act-cli/pkg/gh"
|
||||
"github.com/actions-oss/act-cli/pkg/model"
|
||||
"github.com/actions-oss/act-cli/pkg/runner"
|
||||
)
|
||||
@@ -411,6 +412,15 @@ func newRunCommand(ctx context.Context, input *Input) func(*cobra.Command, []str
|
||||
log.Debugf("Loading secrets from %s", input.Secretfile())
|
||||
secrets := newSecrets(input.secrets)
|
||||
_ = readEnvs(input.Secretfile(), secrets)
|
||||
hasGitHubToken := false
|
||||
for k := range secrets {
|
||||
if strings.EqualFold(k, "GITHUB_TOKEN") {
|
||||
hasGitHubToken = true
|
||||
}
|
||||
}
|
||||
if !hasGitHubToken {
|
||||
secrets["GITHUB_TOKEN"], _ = gh.GetToken(ctx, "")
|
||||
}
|
||||
|
||||
log.Debugf("Loading vars from %s", input.Varfile())
|
||||
vars := newSecrets(input.vars)
|
||||
|
||||
Reference in New Issue
Block a user