mirror of
https://git.ari.lt/ari/forgejo-stats.git
synced 2024-12-22 06:22:46 +00:00
53 lines
1.5 KiB
YAML
53 lines
1.5 KiB
YAML
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
paths-ignore:
|
|
- "commits.svg"
|
|
- "languages.svg"
|
|
schedule:
|
|
- cron: "0 */12 * * *"
|
|
|
|
jobs:
|
|
stats:
|
|
runs-on: ubuntu-latest
|
|
container: catthehacker/ubuntu:act-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
token: ${{ secrets.GIT_TOKEN }}
|
|
|
|
- name: Set up repository
|
|
id: check_commit
|
|
run: |
|
|
git reset --hard
|
|
git pull
|
|
git reset --hard
|
|
|
|
- uses: actions/setup-python@v5
|
|
with:
|
|
python-version: "3.10"
|
|
cache: "pip"
|
|
|
|
- name: Install dependencies
|
|
run: |
|
|
pip install -r requirements.txt
|
|
|
|
- name: Generate statistics
|
|
run: |
|
|
python3 stats.py
|
|
|
|
- name: Stage the changes
|
|
run: |
|
|
git add languages.svg commits.svg
|
|
|
|
- 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"
|
|
git push origin HEAD -f
|
|
fi
|