ci: run treefmt

This commit is contained in:
Matt Sturgeon 2025-07-09 21:55:01 +01:00
parent 405132bab3
commit 22b3c49a0e
3 changed files with 16 additions and 8 deletions

View file

@ -65,7 +65,7 @@ jobs:
id: extract-maintainers id: extract-maintainers
env: env:
PR_AUTHOR: "${{ github.event.pull_request.user.login }}" PR_AUTHOR: "${{ github.event.pull_request.user.login }}"
CHANGED_FILES: '${{ steps.changed-files.outputs.changed_files }}' CHANGED_FILES: "${{ steps.changed-files.outputs.changed_files }}"
run: | run: |
MAINTAINERS_LIST=$(./ci/tag-maintainers/extract-maintainers.py \ MAINTAINERS_LIST=$(./ci/tag-maintainers/extract-maintainers.py \
--changed-files "$CHANGED_FILES" \ --changed-files "$CHANGED_FILES" \

View file

@ -37,7 +37,7 @@ def extract_maintainers(changed_files: List[str], pr_author: str) -> List[str]:
print("Finding maintainers for changed files...", file=sys.stderr) print("Finding maintainers for changed files...", file=sys.stderr)
changed_files_nix = '[ ' + ' '.join(f'"{f}"' for f in changed_files) + ' ]' changed_files_nix = "[ " + " ".join(f'"{f}"' for f in changed_files) + " ]"
nix_expr = f""" nix_expr = f"""
let let
@ -83,10 +83,16 @@ def extract_maintainers(changed_files: List[str], pr_author: str) -> List[str]:
filtered_maintainers = [m for m in maintainers if m != pr_author] filtered_maintainers = [m for m in maintainers if m != pr_author]
if not filtered_maintainers: if not filtered_maintainers:
print("No maintainers found for changed files (or only the PR author is a maintainer).", file=sys.stderr) print(
"No maintainers found for changed files (or only the PR author is a maintainer).",
file=sys.stderr,
)
return [] return []
else: else:
print(f"Found maintainers to notify: {' '.join(filtered_maintainers)}", file=sys.stderr) print(
f"Found maintainers to notify: {' '.join(filtered_maintainers)}",
file=sys.stderr,
)
return filtered_maintainers return filtered_maintainers
@ -107,9 +113,9 @@ def main() -> None:
) )
args = parser.parse_args() args = parser.parse_args()
changed_files = [f.strip() for f in args.changed_files.split('\n') if f.strip()] changed_files = [f.strip() for f in args.changed_files.split("\n") if f.strip()]
maintainers = extract_maintainers(changed_files, args.pr_author) maintainers = extract_maintainers(changed_files, args.pr_author)
print(' '.join(maintainers)) print(" ".join(maintainers))
if __name__ == "__main__": if __name__ == "__main__":

View file

@ -104,7 +104,8 @@ class MetaMaintainerGenerator:
print(f"📦 Nixpkgs maintainers: {len(nixpkgs_maintainers)}") print(f"📦 Nixpkgs maintainers: {len(nixpkgs_maintainers)}")
with open(self.output_file, "w") as f: with open(self.output_file, "w") as f:
f.write(inspect.cleandoc(""" f.write(
inspect.cleandoc("""
# Nixvim all maintainers list. # Nixvim all maintainers list.
# #
# This file lists all referenced maintainers in Nixvim. # This file lists all referenced maintainers in Nixvim.
@ -114,7 +115,8 @@ class MetaMaintainerGenerator:
# #
# To regenerate: nix run .#generate-all-maintainers # To regenerate: nix run .#generate-all-maintainers
# #
""")) """)
)
# Use the formatted maintainers from Nix evaluation # Use the formatted maintainers from Nix evaluation
print( print(