summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorearl-warren <earl-warren@noreply.code.forgejo.org>2025-01-05 12:28:57 +0100
committerearl-warren <earl-warren@noreply.code.forgejo.org>2025-01-05 12:28:57 +0100
commitc13e72386eaf8a10646639a6f81b537e9efa2b1f (patch)
tree2d25a115e64ce8cbc659c33aa952d720a7c1bccf
parentMerge pull request 'chore(lint): fix lint errors' (#84) from earl-warren/act:... (diff)
parentfeat: export runtime token as FORGEJO_TOKEN (diff)
downloadforgejo-act-c13e72386eaf8a10646639a6f81b537e9efa2b1f.tar.xz
forgejo-act-c13e72386eaf8a10646639a6f81b537e9efa2b1f.zip
Merge pull request 'feat: export runtime token as FORGEJO_TOKEN' (#88) from xtex/act:forgejo-token-env into main
Reviewed-on: https://code.forgejo.org/forgejo/act/pulls/88 Reviewed-by: Michael Kriese <michael.kriese@gmx.de>
-rw-r--r--pkg/runner/run_context.go1
-rw-r--r--pkg/runner/run_context_test.go1
2 files changed, 2 insertions, 0 deletions
diff --git a/pkg/runner/run_context.go b/pkg/runner/run_context.go
index 3597ce6..a833324 100644
--- a/pkg/runner/run_context.go
+++ b/pkg/runner/run_context.go
@@ -1198,6 +1198,7 @@ func (rc *RunContext) withGithubEnv(ctx context.Context, github *model.GithubCon
env["GITHUB_REF_NAME"] = github.RefName
env["GITHUB_REF_TYPE"] = github.RefType
env["GITHUB_TOKEN"] = github.Token
+ env["FORGEJO_TOKEN"] = github.Token
env["GITHUB_JOB"] = github.Job
env["GITHUB_REPOSITORY_OWNER"] = github.RepositoryOwner
env["GITHUB_RETENTION_DAYS"] = github.RetentionDays
diff --git a/pkg/runner/run_context_test.go b/pkg/runner/run_context_test.go
index af0cd4e..b86638f 100644
--- a/pkg/runner/run_context_test.go
+++ b/pkg/runner/run_context_test.go
@@ -394,6 +394,7 @@ func TestGetGitHubContext(t *testing.T) {
assert.Equal(t, ghc.RepositoryOwner, owner)
assert.Equal(t, ghc.RunnerPerflog, "/dev/null")
assert.Equal(t, ghc.Token, rc.Config.Secrets["GITHUB_TOKEN"])
+ assert.Equal(t, ghc.Token, rc.Config.Secrets["FORGEJO_TOKEN"])
assert.Equal(t, ghc.Job, "job1")
}