LoadAutoApproveSet returns the set of auto-approve scope names. Sources (merged): recommend=="true" in scope_priorities.json + explicit allow/deny in scope_overrides.json.
()
| 221 | // Sources (merged): recommend=="true" in scope_priorities.json |
| 222 | // + explicit allow/deny in scope_overrides.json. |
| 223 | func LoadAutoApproveSet() map[string]bool { |
| 224 | if cachedAutoApproveSet != nil { |
| 225 | return cachedAutoApproveSet |
| 226 | } |
| 227 | |
| 228 | m := make(map[string]bool) |
| 229 | |
| 230 | // 1. From scope_priorities.json (Recommend == "true") |
| 231 | if data, err := registryFS.ReadFile("scope_priorities.json"); err == nil { |
| 232 | var entries []scopePriorityEntry |
| 233 | if json.Unmarshal(data, &entries) == nil { |
| 234 | for _, entry := range entries { |
| 235 | if entry.Recommend == "true" { |
| 236 | m[entry.ScopeName] = true |
| 237 | } |
| 238 | } |
| 239 | } |
| 240 | } |
| 241 | |
| 242 | // 2. From scope_overrides.json (recommend.allow/deny lists) |
| 243 | if data, err := registryFS.ReadFile("scope_overrides.json"); err == nil { |
| 244 | var wrapper struct { |
| 245 | AutoApprove struct { |
| 246 | Allow []string `json:"allow"` |
| 247 | Deny []string `json:"deny"` |
| 248 | } `json:"recommend"` |
| 249 | } |
| 250 | if json.Unmarshal(data, &wrapper) == nil { |
| 251 | for _, s := range wrapper.AutoApprove.Allow { |
| 252 | m[s] = true |
| 253 | } |
| 254 | for _, s := range wrapper.AutoApprove.Deny { |
| 255 | delete(m, s) |
| 256 | } |
| 257 | } |
| 258 | } |
| 259 | |
| 260 | cachedAutoApproveSet = m |
| 261 | return cachedAutoApproveSet |
| 262 | } |
| 263 | |
| 264 | // LoadPlatformAutoApproveSet returns scopes with AutoApprove rule on the platform |
| 265 | // (from scope_priorities.json only, before overrides). |