feat: added ability to generate stats on PR and sent to latest comment on PR

This commit is contained in:
Anmol Singh
2023-02-25 01:52:33 +05:30
parent c8ef0e49be
commit 94e4a6cbde
4 changed files with 86 additions and 2 deletions

View File

@@ -185,8 +185,17 @@ async def main():
init_localization_manager()
DBM.i("Managers initialized.")
if GHM.update_readme(await get_stats()):
DBM.g("Readme updated!")
stats = await get_stats()
if not EM.DEBUG_RUN:
if GHM.update_readme(stats):
DBM.g("Readme updated!")
else:
DBM.i("Commenting PR...")
pr_data = await DM.get_remote_graphql("get_pr_id", pr_number=EM.PR_NUMBER)
pr_id = pr_data["data"]["repository"]["pullRequest"]["id"]
await DM.get_remote_graphql("add_pr_comment", pr_id=pr_id, comment=stats)
DBM.g("PR commented!")
DBM.g("Debug run, readme not updated. check the latest comment for the generated stats.")
await DM.close_remote_resources()