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.