From 5302c25feb6d64b682dd789d41984295db919050 Mon Sep 17 00:00:00 2001 From: Jack Jackson Date: Thu, 8 May 2025 01:58:31 +0000 Subject: [PATCH] Add environment variables for OIDC token service (#674) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Resurrecting [this PR](https://gitea.com/gitea/act_runner/pulls/272) (a dependency of [this one](https://github.com/go-gitea/gitea/pull/33945)) after the original author [lost motivation](https://github.com/go-gitea/gitea/pull/25664#issuecomment-2737099259) - though, to be clear, all credit belongs to them, and all blame for mistakes or misunderstandings to me. Co-authored-by: Søren L. Hansen Reviewed-on: https://gitea.com/gitea/act_runner/pulls/674 Reviewed-by: ChristopherHX Reviewed-by: Lunny Xiao Co-authored-by: Jack Jackson Co-committed-by: Jack Jackson --- internal/app/run/runner.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/internal/app/run/runner.go b/internal/app/run/runner.go index 710bb47..a372d98 100644 --- a/internal/app/run/runner.go +++ b/internal/app/run/runner.go @@ -163,6 +163,12 @@ func (r *Runner) run(ctx context.Context, task *runnerv1.Task, reporter *report. preset.Token = t } + if actionsIdTokenRequestUrl := taskContext["actions_id_token_request_url"].GetStringValue(); actionsIdTokenRequestUrl != "" { + r.envs["ACTIONS_ID_TOKEN_REQUEST_URL"] = actionsIdTokenRequestUrl + r.envs["ACTIONS_ID_TOKEN_REQUEST_TOKEN"] = taskContext["actions_id_token_request_token"].GetStringValue() + task.Secrets["ACTIONS_ID_TOKEN_REQUEST_TOKEN"] = r.envs["ACTIONS_ID_TOKEN_REQUEST_TOKEN"] + } + giteaRuntimeToken := taskContext["gitea_runtime_token"].GetStringValue() if giteaRuntimeToken == "" { // use task token to action api token for previous Gitea Server Versions