mirror of
https://github.com/nix-community/home-manager.git
synced 2025-11-08 19:46:05 +01:00
ci: extract maintainers with single file eval (#7548)
Currently, we send all files as a list but it can be problematic with files that can't be evaluated properly. Instead of crashing the entire extraction process, we will send a file at a time for eval so we can just bypass files causing issues. Signed-off-by: Austin Horstman <khaneliman12@gmail.com>
This commit is contained in:
parent
a1817d1c0e
commit
37fec70bd5
2 changed files with 65 additions and 74 deletions
|
|
@ -55,19 +55,25 @@ def extract_maintainers(changed_files: list[str], pr_author: str) -> list[str]:
|
|||
|
||||
logging.info("Finding maintainers for changed files...")
|
||||
nix_file = Path(__file__).parent.parent / "nix" / "extract-maintainers.nix"
|
||||
changed_files_json = json.dumps(changed_files)
|
||||
|
||||
try:
|
||||
result_json = run_nix_eval(nix_file, "--argstr", "changedFilesJson", changed_files_json)
|
||||
maintainers = set(json.loads(result_json))
|
||||
except NixEvalError:
|
||||
# Error is already logged by run_nix_eval
|
||||
return []
|
||||
except json.JSONDecodeError as e:
|
||||
logging.error(f"Error parsing JSON output from Nix: {e}")
|
||||
return []
|
||||
all_maintainers = set()
|
||||
|
||||
filtered_maintainers = sorted(list(maintainers - {pr_author}))
|
||||
for file in changed_files:
|
||||
try:
|
||||
result_json = run_nix_eval(nix_file, "--argstr", "file", file)
|
||||
file_maintainers = json.loads(result_json)
|
||||
all_maintainers.update(file_maintainers)
|
||||
if file_maintainers:
|
||||
logging.debug(f"Found maintainers for {file}: {file_maintainers}")
|
||||
except NixEvalError:
|
||||
# Error is already logged by run_nix_eval, just skip this file
|
||||
logging.debug(f"Skipping {file} due to evaluation error")
|
||||
continue
|
||||
except json.JSONDecodeError as e:
|
||||
logging.error(f"Error parsing JSON output from Nix for {file}: {e}")
|
||||
continue
|
||||
|
||||
filtered_maintainers = sorted(list(all_maintainers - {pr_author}))
|
||||
|
||||
if not filtered_maintainers:
|
||||
logging.info("No maintainers found (or only the PR author is a maintainer).")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue