From 3ae785a45ce06db4307303dfc41c627d77b2338d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kuba=20Szczodrzy=C5=84ski?= Date: Tue, 6 Apr 2021 21:50:51 +0200 Subject: [PATCH] [Actions] Limit Google Play changelog to 500 chars. --- .github/utils/extract_changelogs.py | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/.github/utils/extract_changelogs.py b/.github/utils/extract_changelogs.py index 07524bad..25d346c1 100644 --- a/.github/utils/extract_changelogs.py +++ b/.github/utils/extract_changelogs.py @@ -21,10 +21,8 @@ if __name__ == "__main__": print("::set-output name=changelogDir::" + dir) (title, changelog) = get_changelog(project_dir, format="plain") - with open(dir + "whatsnew-pl-PL", "w", encoding="utf-8") as f: - f.write(changelog) - print("::set-output name=changelogPlainFile::" + dir + "whatsnew-pl-PL") + # plain text changelog - Firebase App Distribution with open(dir + "whatsnew-titled.txt", "w", encoding="utf-8") as f: f.write(title) f.write("\n") @@ -33,16 +31,31 @@ if __name__ == "__main__": print("::set-output name=changelogTitle::" + title) + # plain text changelog, max 500 chars - Google Play + with open(dir + "whatsnew-pl-PL", "w", encoding="utf-8") as f: + changelog_lines = changelog.split("\n") + changelog = "" + for line in changelog_lines: + if len(changelog) + len(line) < 500: + changelog += "\n" + line + changelog = changelog.strip() + f.write(changelog) + + print("::set-output name=changelogPlainFile::" + dir + "whatsnew-pl-PL") + + # markdown changelog - Discord webhook (_, changelog) = get_changelog(project_dir, format="markdown") with open(dir + "whatsnew.md", "w", encoding="utf-8") as f: f.write(changelog) print("::set-output name=changelogMarkdownFile::" + dir + "whatsnew.md") + # html changelog - version info in DB (_, changelog) = get_changelog(project_dir, format="html") with open(dir + "whatsnew.html", "w", encoding="utf-8") as f: f.write(changelog) print("::set-output name=changelogHtmlFile::" + dir + "whatsnew.html") + changelog = get_commit_log(project_dir, format="plain", max_lines=10) with open(dir + "commit_log.txt", "w", encoding="utf-8") as f: f.write(changelog)