add token support for exec (#247)

allow to pass token from secrets

Reviewed-on: https://gitea.com/gitea/act_runner/pulls/247
Reviewed-by: Jason Song <i@wolfogre.com>
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: Tomasz Duda <tomaszduda23@gmail.com>
Co-committed-by: Tomasz Duda <tomaszduda23@gmail.com>
This commit is contained in:
Tomasz Duda 2023-06-20 08:41:22 +00:00 committed by Jason Song
parent 8c14933e70
commit b0bd503b11
1 changed files with 6 additions and 0 deletions

View File

@ -416,6 +416,12 @@ func runExec(ctx context.Context, execArgs *executeArgs) func(cmd *cobra.Command
config.Env["ACT_EXEC"] = "true"
if t := config.Secrets["GITEA_TOKEN"]; t != "" {
config.Token = t
} else if t := config.Secrets["GITHUB_TOKEN"]; t != "" {
config.Token = t
}
if !execArgs.debug {
logLevel := log.Level(log.InfoLevel)
config.JobLoggerLevel = &logLevel