From 24b3af211b604efb9b96932ecc012ed2016fb7e4 Mon Sep 17 00:00:00 2001 From: Nikhil Badyal Date: Fri, 25 Aug 2023 23:05:32 +0530 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Changelog=20not=20getting=20gene?= =?UTF-8?q?rated?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/downloader/github.py | 1 + src/utils.py | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/downloader/github.py b/src/downloader/github.py index 5041c14..0045c35 100644 --- a/src/downloader/github.py +++ b/src/downloader/github.py @@ -76,6 +76,7 @@ class Github(Downloader): headers["Authorization"] = f"token {config.personal_access_token}" response = requests.get(api_url, headers=headers, timeout=60) handle_request_response(response) + update_changelog(f"{github_repo_owner}/{github_repo_name}", response.json()) assets = response.json()["assets"] try: filter_pattern = re.compile(asset_filter) diff --git a/src/utils.py b/src/utils.py index c343fab..6a1e29e 100644 --- a/src/utils.py +++ b/src/utils.py @@ -28,6 +28,7 @@ request_header = { "Content-Type": "application/json", } bs4_parser = "html.parser" +changelog_file = "changelog.md" def update_changelog(name: str, response: Dict[str, str]) -> None: @@ -84,7 +85,7 @@ def write_to_file(change_log: str) -> None: change_log : str A string representing the changelog that you want to write to the file. """ - with Path("changelog.md").open("w", encoding="utf_8") as file1: + with Path(changelog_file).open("a", encoding="utf_8") as file1: file1.write(change_log) @@ -193,6 +194,11 @@ def extra_downloads(config: RevancedConfig) -> None: logger.info("Unable to download extra file. Provide input in url@name.apk format.") +def delete_old_changelog() -> None: + """The function `delete_old_changelog` deleted old changelog file.""" + Path(changelog_file).unlink(missing_ok=True) + + def apkmirror_status_check(package_name: str) -> Any: """The `apkmirror_status_check` function checks if an app exists on APKMirror.