From 807aca38295fb5252a5f9153668f26b8872fb913 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9B=D1=83=D0=BA=D0=B0?= <164436043+ghluka@users.noreply.github.com> Date: Sun, 5 May 2024 11:46:15 -0400 Subject: [PATCH] Supported websites action --- .github/workflows/update_readme.yml | 40 +++++++++++++++++++++++++++++ README.md | 36 ++++++++++++++------------ update_list.py | 23 +++++++++++++++++ 3 files changed, 82 insertions(+), 17 deletions(-) create mode 100644 .github/workflows/update_readme.yml create mode 100644 update_list.py diff --git a/.github/workflows/update_readme.yml b/.github/workflows/update_readme.yml new file mode 100644 index 0000000..a02c318 --- /dev/null +++ b/.github/workflows/update_readme.yml @@ -0,0 +1,40 @@ +name: Update README + +on: + push: + branches: + - main + +jobs: + lint: + runs-on: ubuntu-latest + + permissions: + contents: write + + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 2 + - uses: actions/setup-python@v4 + with: + python-version: '3.10' + - name: Update README + run: python update_list.py + + - id: last-commit-message + run: echo "msg=$(git log -1 --pretty=%s)" >> $GITHUB_OUTPUT + - id: get-author-name + run: echo "msg=$(git log -1 --pretty=%an)" >> $GITHUB_OUTPUT + - id: get-author-email + run: echo "msg=$(git log -1 --pretty=%aE)" >> $GITHUB_OUTPUT + + - uses: stefanzweifel/git-auto-commit-action@v4 + with: + commit_user_name: ${{ steps.get-author-name.outputs.msg }} + commit_user_email: ${{ steps.get-author-email.outputs.msg }} + commit_author: ${{ steps.get-author-name.outputs.msg }} <${{ steps.get-author-email.outputs.msg }}> + commit_message: ${{ steps.last-commit-message.outputs.msg }} + commit_options: '--amend --no-edit' + push_options: '--force' + skip_fetch: true \ No newline at end of file diff --git a/README.md b/README.md index a69c584..8ee6a61 100644 --- a/README.md +++ b/README.md @@ -18,20 +18,22 @@ $ pip install -r requirements.txt $ python3 main.py ``` -## 📃 Supported websites - -- Chess.com -- GitHub -- GitLab -- Instagram -- Kahoot -- Lichess -- Minecraft -- Replit -- Roblox -- Solo.to -- Soundcloud -- Speedrun.com -- Steam -- Twitch -- X \ No newline at end of file +## 📃 Supported websites [15 total] + +- [Chess.com](https://chess.com/) +- [Github](https://github.com/) +- [Gitlab](https://gitlab.com/) +- [Instagram](https://instagram.com/) +- [Kahoot](https://kahoot.it/) +- [Lichess](https://lichess.org/) +- [Minecraft](https://minecraft.net/) +- [Replit](https://repl.it/) +- [Roblox](https://roblox.com/) +- [Solo.to](https://solo.to/) +- [Soundcloud](https://soundcloud.com/) +- [Speedrun.com](https://speedrun.com/) +- [Steam](https://soundcloud.com/) +- [Twitch](https://twitch.tv/) +- [X](https://x.com/) + + \ No newline at end of file diff --git a/update_list.py b/update_list.py new file mode 100644 index 0000000..7d1a16f --- /dev/null +++ b/update_list.py @@ -0,0 +1,23 @@ +"""Updates the list of websites in the README +""" + +import glob + +files = sorted(glob.glob("./src/checkers/*.py", recursive=True)) +with open('README.md', 'r', encoding='utf-8') as f: + f_text = f.read() + md = f_text.split("")[0] + md += f"[{len(files)} total]\n" + + for file in files: + file = file.replace("\\", "/") + with open(file, "r") as f: + link = f.readlines()[0].strip().removeprefix("\"\"\"") + website = file.split("/")[-1].removesuffix(".py").replace("-", ".").capitalize() + md += f"\n- [{website}]({link})" + + md += '\n\n' + md += f_text.split("")[1] + +with open('README.md', 'w', encoding='utf-8') as f: + f.write(md) \ No newline at end of file