diff --git a/scripts/language_stats.py b/scripts/language_stats.py index 8326900..e9a0c1b 100644 --- a/scripts/language_stats.py +++ b/scripts/language_stats.py @@ -1,9 +1,9 @@ #!/usr/bin/env python3 """ -Gitea Language Stats Action +Gitea Language Stats Calculates the percentage of every programming language used -in all repositories of a given account and writes / updates -a markdown table inside `.profile/README.md` delimited by the +in all repositories of a given account and prints a markdown +table to stdout, delimited by the markers . Required environment variables @@ -76,21 +76,5 @@ for lang, nbytes in pairs: block = "\n" + "".join(lines) + "\n" -# ---------- patch .profile/README.md ---------- -readme_path = ".profile/README.md" -os.makedirs(".profile", exist_ok=True) -if not os.path.exists(readme_path): - with open(readme_path, "w", encoding="utf-8") as fh: - fh.write(block) -else: - with open(readme_path, "r+", encoding="utf-8") as fh: - content = fh.read() - if "" in content and "" in content: - pre = content.split("")[0] - post = content.split("")[-1] - content = pre + block + post - else: - content = content.rstrip() + "\n\n" + block - fh.seek(0) - fh.write(content) - fh.truncate() +# ---------- output markdown block ---------- +print(block)