2024-06-20 23:29:56 +00:00
|
|
|
on:
|
2024-06-21 19:34:41 +00:00
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- main
|
|
|
|
paths-ignore:
|
2024-11-01 21:58:20 +00:00
|
|
|
- "commits.svg"
|
|
|
|
- "languages.svg"
|
2024-06-21 19:34:41 +00:00
|
|
|
schedule:
|
2024-11-01 21:58:42 +00:00
|
|
|
- cron: "0 */12 * * *"
|
2024-06-20 23:29:56 +00:00
|
|
|
|
|
|
|
jobs:
|
2024-06-21 19:34:41 +00:00
|
|
|
stats:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
container: catthehacker/ubuntu:act-latest
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v4
|
|
|
|
with:
|
|
|
|
token: ${{ secrets.GIT_TOKEN }}
|
2024-06-20 23:29:56 +00:00
|
|
|
|
2024-06-22 16:58:21 +00:00
|
|
|
- name: Set up repository
|
2024-06-21 19:34:41 +00:00
|
|
|
id: check_commit
|
|
|
|
run: |
|
2024-06-22 12:20:49 +00:00
|
|
|
git reset --hard
|
|
|
|
git pull
|
|
|
|
git reset --hard
|
2024-06-20 23:29:56 +00:00
|
|
|
|
2024-06-21 19:34:41 +00:00
|
|
|
- uses: actions/setup-python@v5
|
|
|
|
with:
|
|
|
|
python-version: "3.10"
|
|
|
|
cache: "pip"
|
2024-06-20 23:29:56 +00:00
|
|
|
|
2024-06-21 19:34:41 +00:00
|
|
|
- name: Install dependencies
|
|
|
|
run: |
|
|
|
|
pip install -r requirements.txt
|
2024-06-20 23:29:56 +00:00
|
|
|
|
2024-06-21 19:34:41 +00:00
|
|
|
- name: Generate statistics
|
|
|
|
run: |
|
|
|
|
python3 stats.py
|
2024-06-20 23:29:56 +00:00
|
|
|
|
2024-06-21 19:34:41 +00:00
|
|
|
- name: Stage the changes
|
|
|
|
run: |
|
2024-11-01 21:58:20 +00:00
|
|
|
git add languages.svg commits.svg
|
2024-06-20 23:29:56 +00:00
|
|
|
|
2024-06-21 19:34:41 +00:00
|
|
|
- name: Commit and Push Changes
|
|
|
|
run: |
|
|
|
|
if git diff --staged --quiet; then
|
|
|
|
echo "No changes to commit."
|
|
|
|
else
|
|
|
|
git config --local user.email "stats@localhost"
|
|
|
|
git config --local user.name "Stats CI/CD"
|
|
|
|
git commit -am "[skip ci] Update stats" || echo "No changes to commit"
|
2024-06-22 12:20:49 +00:00
|
|
|
git push origin HEAD -f
|
2024-06-21 19:34:41 +00:00
|
|
|
fi
|