Skip to content

Commit 6cfe67c

Browse files
authored
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.
1 parent 9149221 commit 6cfe67c

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed

models/actions/variable.go

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -100,13 +100,6 @@ func UpdateVariable(ctx context.Context, variable *ActionVariable) (bool, error)
100100
func GetVariablesOfRun(ctx context.Context, run *ActionRun) (map[string]string, error) {
101101
variables := map[string]string{}
102102

103-
// Global
104-
globalVariables, err := FindVariables(ctx, FindVariablesOpts{})
105-
if err != nil {
106-
log.Error("find global variables: %v", err)
107-
return nil, err
108-
}
109-
110103
// Org / User level
111104
ownerVariables, err := FindVariables(ctx, FindVariablesOpts{OwnerID: run.Repo.OwnerID})
112105
if err != nil {
@@ -121,8 +114,8 @@ func GetVariablesOfRun(ctx context.Context, run *ActionRun) (map[string]string,
121114
return nil, err
122115
}
123116

124-
// Level precedence: Repo > Org / User > Global
125-
for _, v := range append(globalVariables, append(ownerVariables, repoVariables...)...) {
117+
// Level precedence: Repo > Org / User
118+
for _, v := range append(ownerVariables, repoVariables...) {
126119
variables[v.Name] = v.Data
127120
}
128121

0 commit comments

Comments
 (0)