diff options
author | Jason Song <i@wolfogre.com> | 2024-04-11 11:25:05 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-11 03:25:05 +0000 |
commit | 6cfe67cfc36558d421762d66159a17be3506bce9 (patch) | |
tree | 433ba5e88ae9a7491cb68b870a2ad7435b667a7b | |
parent | 9149221845670982b9f499fe49ffabf00c4a5e8b (diff) | |
download | gitea-6cfe67cfc36558d421762d66159a17be3506bce9.tar.gz gitea-6cfe67cfc36558d421762d66159a17be3506bce9.zip |
No global variables (#30402)
Fix #30361, regression of #29782 which is a backport, not the original
#29468.
#29468 did a small refactor which introduced a new function
`GetVariablesOfRun`. However, it's designed for v1.22 which supports
global variables.
After backporting it to v1.21, it will still try to get global
variables, which causes it to retrieve all variables.
-rw-r--r-- | models/actions/variable.go | 11 |
1 files changed, 2 insertions, 9 deletions
diff --git a/models/actions/variable.go b/models/actions/variable.go index 66e2007946..2620a566f7 100644 --- a/models/actions/variable.go +++ b/models/actions/variable.go @@ -100,13 +100,6 @@ func UpdateVariable(ctx context.Context, variable *ActionVariable) (bool, error) func GetVariablesOfRun(ctx context.Context, run *ActionRun) (map[string]string, error) { variables := map[string]string{} - // Global - globalVariables, err := FindVariables(ctx, FindVariablesOpts{}) - if err != nil { - log.Error("find global variables: %v", err) - return nil, err - } - // Org / User level ownerVariables, err := FindVariables(ctx, FindVariablesOpts{OwnerID: run.Repo.OwnerID}) if err != nil { @@ -121,8 +114,8 @@ func GetVariablesOfRun(ctx context.Context, run *ActionRun) (map[string]string, return nil, err } - // Level precedence: Repo > Org / User > Global - for _, v := range append(globalVariables, append(ownerVariables, repoVariables...)...) { + // Level precedence: Repo > Org / User + for _, v := range append(ownerVariables, repoVariables...) { variables[v.Name] = v.Data } |