mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2026-05-12 22:10:25 +00:00
[v14.0/forgejo] feat: add Forgejo server version to runner context (#10643)
**Backport:** https://codeberg.org/forgejo/forgejo/pulls/10642 Currently, there's no way for actions runners to know what version of Forgejo is running on the server side. This makes it difficult/impossible to know which features are available and can make maintaining compatibility tricky. Let's add the Forgejo server version to the context. See associated PR in the runner repo: https://code.forgejo.org/forgejo/runner/pulls/1249 Co-authored-by: John Moon <john.moon@vts-i.com> Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/10643 Reviewed-by: Mathieu Fenniak <mfenniak@noreply.codeberg.org> Reviewed-by: Michael Kriese <michael.kriese@gmx.de> Reviewed-by: Beowulf <beowulf@beocode.eu> Co-authored-by: forgejo-backport-action <forgejo-backport-action@noreply.codeberg.org> Co-committed-by: forgejo-backport-action <forgejo-backport-action@noreply.codeberg.org>
This commit is contained in:
parent
180ebee6de
commit
766104acae
2 changed files with 2 additions and 0 deletions
|
|
@ -101,6 +101,7 @@ func GenerateGiteaContext(run *actions_model.ActionRun, job *actions_model.Actio
|
|||
|
||||
// additional contexts
|
||||
gitContext["gitea_default_actions_url"] = setting.Actions.DefaultActionsURL.URL()
|
||||
gitContext["forgejo_server_version"] = setting.AppVer
|
||||
|
||||
if job != nil {
|
||||
gitContext["job"] = job.JobID
|
||||
|
|
|
|||
|
|
@ -443,6 +443,7 @@ jobs:
|
|||
assert.Equal(t, actionRun.WorkflowID, gtCtx["workflow"].GetStringValue())
|
||||
assert.Equal(t, "user2/actions-gitea-context/.gitea/workflows/pull.yml@refs/pull/1/head", gtCtx["workflow_ref"].GetStringValue())
|
||||
assert.Equal(t, setting.Actions.DefaultActionsURL.URL(), gtCtx["gitea_default_actions_url"].GetStringValue())
|
||||
assert.Equal(t, setting.AppVer, gtCtx["forgejo_server_version"].GetStringValue())
|
||||
token := gtCtx["token"].GetStringValue()
|
||||
assert.Equal(t, actionTask.TokenLastEight, token[len(token)-8:])
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue