From b0bd503b117dc457ffdbe17a1b3f16d2471df09e Mon Sep 17 00:00:00 2001 From: Tomasz Duda Date: Tue, 20 Jun 2023 08:41:22 +0000 Subject: [PATCH] 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 Reviewed-by: Lunny Xiao Co-authored-by: Tomasz Duda Co-committed-by: Tomasz Duda --- internal/app/cmd/exec.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/internal/app/cmd/exec.go b/internal/app/cmd/exec.go index 37571e7..97b6752 100644 --- a/internal/app/cmd/exec.go +++ b/internal/app/cmd/exec.go @@ -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