Просмотр исходного кода

fix(github-actions): replace nonlocal with global for cached variables

The action uses cached variables (`_release_assets_cache`, `_release_info_cache`) within nested function scopes. Using `nonlocal` is incorrect as these variables are defined in the module's global scope, not in an enclosing function scope. This change corrects the variable declaration to `global` to properly access and modify the module-level cache variables, preventing potential UnboundLocalError or incorrect cache behavior.
TheWildJames 4 месяцев назад
Родитель
Сommit
d10cfe0c60
1 измененных файлов с 2 добавлено и 2 удалено
  1. 2 2
      .github/actions/download-kernel/action.yml

+ 2 - 2
.github/actions/download-kernel/action.yml

@@ -221,7 +221,7 @@ runs:
             return None
 
         def get_toolchain_release_assets() -> list[dict]:
-            nonlocal _release_assets_cache
+            global _release_assets_cache
             with _release_assets_lock:
                 if _release_assets_cache is not None:
                     return _release_assets_cache
@@ -254,7 +254,7 @@ runs:
                     return _release_assets_cache
 
         def get_or_create_toolchain_release() -> dict | None:
-            nonlocal _release_info_cache, _release_assets_cache
+            global _release_info_cache, _release_assets_cache
             with _release_info_lock:
                 if _release_info_cache is not None:
                     return _release_info_cache