fix: add forgejo_default_actions_url to actions context (#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.

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/13406
Reviewed-by: Mathieu Fenniak <mfenniak@noreply.codeberg.org>
This commit is contained in:
Andreas Ahlenstorf 2026-07-12 03:03:30 +02:00 committed by Mathieu Fenniak
commit e8c096d0fd
2 changed files with 5 additions and 1 deletions

View file

@ -115,7 +115,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 {

View file

@ -90,6 +90,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)