Skip to content

Commit

Permalink
Supported websites action
Browse files Browse the repository at this point in the history
  • Loading branch information
ghluka committed May 5, 2024
1 parent df0c5a3 commit 807aca3
Show file tree
Hide file tree
Showing 3 changed files with 82 additions and 17 deletions.
40 changes: 40 additions & 0 deletions .github/workflows/update_readme.yml
Original file line number Diff line number Diff line change
@@ -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
36 changes: 19 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
## 📃 Supported websites <!-- Websites start -->[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/)

<!-- Websites end -->
23 changes: 23 additions & 0 deletions update_list.py
Original file line number Diff line number Diff line change
@@ -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("<!-- Websites start -->")[0]
md += f"<!-- Websites start -->[{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<!-- Websites end -->'
md += f_text.split("<!-- Websites end -->")[1]

with open('README.md', 'w', encoding='utf-8') as f:
f.write(md)

0 comments on commit 807aca3

Please sign in to comment.