From 2d51185e6c8ea4ea1fbce11f7a56ce46dc420f83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Fri, 13 Sep 2024 20:56:10 +0200 Subject: [PATCH] webhooks: fix handling apps dir --- webhooks/webhook.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/webhooks/webhook.py b/webhooks/webhook.py index 440a6ee..f8a11eb 100755 --- a/webhooks/webhook.py +++ b/webhooks/webhook.py @@ -20,9 +20,11 @@ from sanic import HTTPResponse, Request, Sanic, response # add apps/tools to sys.path sys.path.insert(0, str(Path(__file__).parent.parent)) +from appslib import get_apps_repo from readme_generator.make_readme import generate_READMEs TOOLS_DIR = Path(__file__).resolve().parent.parent +APPS_REPO = None DEBUG = False UNSAFE = False @@ -272,7 +274,7 @@ def reject_wishlist(request: Request, pr_infos: dict, reason=None) -> HTTPRespon def generate_and_commit_readmes(repo: Repo) -> bool: assert repo.working_tree_dir is not None - generate_READMEs(Path(repo.working_tree_dir)) + generate_READMEs(Path(repo.working_tree_dir), APPS_REPO) repo.git.add("README*.md") repo.git.add("ALL_README.md") @@ -300,6 +302,7 @@ def git_repo_rebase_testing_fast_forward(repo: Repo) -> bool: def main() -> None: parser = argparse.ArgumentParser() + get_apps_repo.add_args(parser) parser.add_argument("-d", "--debug", action="store_true") parser.add_argument( "-u", @@ -309,6 +312,9 @@ def main() -> None: ) args = parser.parse_args() + global APPS_REPO + APPS_REPO = get_apps_repo.from_args(args) + if args.debug: logging.getLogger().setLevel(logging.DEBUG)