mirror of
https://git.ari.lt/ari/forgejo-stats.git
synced 2024-12-22 06:22:46 +00:00
fe7877fde6
Signed-off-by: Ari Archer <ari@ari.lt>
55 lines
1.4 KiB
YAML
55 lines
1.4 KiB
YAML
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
paths-ignore:
|
|
- 'commits.png'
|
|
- 'languages.png'
|
|
schedule:
|
|
- cron: '0 */8 * * *'
|
|
|
|
jobs:
|
|
stats:
|
|
runs-on: docker
|
|
container: catthehacker/ubuntu:act-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
token: ${{ secrets.GIT_TOKEN }}
|
|
|
|
- name: Check for Skip CI in Last Commit
|
|
id: check_commit
|
|
run: |
|
|
commit_message=$(git log -1 --pretty=%B)
|
|
if echo "$commit_message" | grep -q "\[skip ci\]"; then
|
|
echo "Skip CI based on commit message" && exit 78;
|
|
fi
|
|
|
|
- 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.png commits.png
|
|
|
|
- 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 add commits.png languages.png
|
|
git commit -am "Update stats" || echo "No changes to commit"
|
|
git push origin HEAD
|
|
fi
|