From 120fbe03d22e9ded697225072285d6774272d330 Mon Sep 17 00:00:00 2001 From: forgejo-backport-action Date: Sun, 12 Jul 2026 04:00:36 +0200 Subject: [PATCH] [v15.0/forgejo] fix: add forgejo_default_actions_url to actions context (#13410) **Backport:** https://codeberg.org/forgejo/forgejo/pulls/13406 Forgejo only added the legacy `gitea_default_actions_url`. ### Tests for Go changes - I added test coverage for Go changes... - [x] in their respective `*_test.go` for unit tests. - [ ] in the `tests/integration` directory if it involves interactions with a live Forgejo server. - I ran... - [x] `make pr-go` before pushing ### Release notes - [ ] This change will be noticed by a Forgejo user or admin (feature, bug fix, performance, etc.). I suggest to include a release note for this change. - [x] This change is not visible to a Forgejo user or admin (refactor, dependency upgrade, etc.). I think there is no need to add a release note for this change. Co-authored-by: Andreas Ahlenstorf Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/13410 Reviewed-by: Mathieu Fenniak --- services/actions/context.go | 3 ++- services/actions/context_test.go | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/services/actions/context.go b/services/actions/context.go index 0313b11031..c1c805d1b2 100644 --- a/services/actions/context.go +++ b/services/actions/context.go @@ -111,7 +111,8 @@ func GenerateGiteaContext(run *actions_model.ActionRun, job *actions_model.Actio gitContext["workflow"] = run.WorkflowID // string, The name of the workflow. If the workflow file doesn't specify a name, the value of this property is the full path of the workflow file in the repository. // additional contexts - gitContext["gitea_default_actions_url"] = setting.Actions.DefaultActionsURL.URL() + gitContext["gitea_default_actions_url"] = setting.Actions.DefaultActionsURL.URL() // Remove after Forgejo 19. + gitContext["forgejo_default_actions_url"] = setting.Actions.DefaultActionsURL.URL() gitContext["forgejo_server_version"] = setting.AppVer if job != nil { diff --git a/services/actions/context_test.go b/services/actions/context_test.go index 665f207219..abb41f031a 100644 --- a/services/actions/context_test.go +++ b/services/actions/context_test.go @@ -84,6 +84,9 @@ func TestGenerateGiteaContext(t *testing.T) { assert.Equal(t, false, context["ref_protected"]) assert.Equal(t, "Actions", context["secret_source"]) assert.Equal(t, setting.AppURL, context["server_url"]) + assert.Equal(t, setting.Actions.DefaultActionsURL.URL(), context["gitea_default_actions_url"]) + assert.Equal(t, setting.Actions.DefaultActionsURL.URL(), context["forgejo_default_actions_url"]) + assert.Equal(t, setting.AppVer, context["forgejo_server_version"]) event, ok := context["event"].(map[string]any) require.True(t, ok)