From fc2ec915a0ed74bf3bbe479da0f77335147fbed8 Mon Sep 17 00:00:00 2001 From: Zettat123 Date: Wed, 15 Jan 2025 12:20:06 +0800 Subject: [PATCH] gitea context --- routers/api/actions/runner/utils.go | 2 +- services/actions/context.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/routers/api/actions/runner/utils.go b/routers/api/actions/runner/utils.go index 6684ebf4317cd..0fd7ca5c447cf 100644 --- a/routers/api/actions/runner/utils.go +++ b/routers/api/actions/runner/utils.go @@ -64,7 +64,7 @@ func generateTaskContext(t *actions_model.ActionTask) *structpb.Struct { log.Error("actions.CreateAuthorizationToken failed: %v", err) } - gitCtx := actions.GenerateGitContext(t.Job.Run, t.Job) + gitCtx := actions.GenerateGiteaContext(t.Job.Run, t.Job) gitCtx["token"] = t.Token gitCtx["gitea_runtime_token"] = giteaRuntimeToken diff --git a/services/actions/context.go b/services/actions/context.go index aa1aea4375f1b..8abfeb515372f 100644 --- a/services/actions/context.go +++ b/services/actions/context.go @@ -16,9 +16,9 @@ import ( "code.gitea.io/gitea/modules/setting" ) -// GenerateGitContext generate the git context without token and gitea_runtime_token +// GenerateGiteaContext generate the gitea context without token and gitea_runtime_token // job can be nil when generating context for interpolating workflow-level expressions -func GenerateGitContext(run *actions_model.ActionRun, job *actions_model.ActionRunJob) map[string]any { +func GenerateGiteaContext(run *actions_model.ActionRun, job *actions_model.ActionRunJob) map[string]any { event := map[string]any{} _ = json.Unmarshal([]byte(run.EventPayload), &event)