feat: use FORGEJO_TOKEN as runtime token

Link: https://codeberg.org/forgejo/forgejo/pulls/6199
pull/389/head
xtex 2024-12-13 20:24:01 +08:00
parent e238532feb
commit 3068bebfcb
No known key found for this signature in database
GPG Key ID: B918086ED8045B91
2 changed files with 6 additions and 2 deletions

View File

@ -418,7 +418,9 @@ func runExec(ctx context.Context, execArgs *executeArgs) func(cmd *cobra.Command
config.Env["ACT_EXEC"] = "true" 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 config.Token = t
} else if t := config.Secrets["GITHUB_TOKEN"]; t != "" { } else if t := config.Secrets["GITHUB_TOKEN"]; t != "" {
config.Token = t config.Token = t

View File

@ -168,7 +168,9 @@ func (r *Runner) run(ctx context.Context, task *runnerv1.Task, reporter *report.
RepositoryOwner: taskContext["repository_owner"].GetStringValue(), RepositoryOwner: taskContext["repository_owner"].GetStringValue(),
RetentionDays: taskContext["retention_days"].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 preset.Token = t
} else if t := task.Secrets["GITHUB_TOKEN"]; t != "" { } else if t := task.Secrets["GITHUB_TOKEN"]; t != "" {
preset.Token = t preset.Token = t