From 3068bebfcb53513aaa089597493902f1291cb8ce Mon Sep 17 00:00:00 2001 From: xtex Date: Fri, 13 Dec 2024 20:24:01 +0800 Subject: [PATCH] feat: use FORGEJO_TOKEN as runtime token Link: https://codeberg.org/forgejo/forgejo/pulls/6199 --- internal/app/cmd/exec.go | 4 +++- internal/app/run/runner.go | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/internal/app/cmd/exec.go b/internal/app/cmd/exec.go index 3e111fe..ea1718b 100644 --- a/internal/app/cmd/exec.go +++ b/internal/app/cmd/exec.go @@ -418,7 +418,9 @@ func runExec(ctx context.Context, execArgs *executeArgs) func(cmd *cobra.Command config.Env["ACT_EXEC"] = "true" - if t := config.Secrets["GITEA_TOKEN"]; t != "" { + if t := config.Secrets["FORGEJO_TOKEN"]; t != "" { + config.Token = t + } else if t := config.Secrets["GITEA_TOKEN"]; t != "" { config.Token = t } else if t := config.Secrets["GITHUB_TOKEN"]; t != "" { config.Token = t diff --git a/internal/app/run/runner.go b/internal/app/run/runner.go index 9eaf37e..29a78dd 100644 --- a/internal/app/run/runner.go +++ b/internal/app/run/runner.go @@ -168,7 +168,9 @@ func (r *Runner) run(ctx context.Context, task *runnerv1.Task, reporter *report. RepositoryOwner: taskContext["repository_owner"].GetStringValue(), RetentionDays: taskContext["retention_days"].GetStringValue(), } - if t := task.Secrets["GITEA_TOKEN"]; t != "" { + if t := task.Secrets["FORGEJO_TOKEN"]; t != "" { + preset.Token = t + } else if t := task.Secrets["GITEA_TOKEN"]; t != "" { preset.Token = t } else if t := task.Secrets["GITHUB_TOKEN"]; t != "" { preset.Token = t