Refresh contributor hours #78
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Refresh contributor hours | |
on: | |
workflow_dispatch: # manual run | |
push: | |
paths: # run only when new reports appear | |
- 'reports/git-hours-*.txt' | |
schedule: | |
- cron: '0 2 * * *' # optional nightly refresh (02:00 UTC) | |
permissions: | |
contents: write # allow the bot to push | |
jobs: | |
rebuild: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 # git-hours may need full history | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.x' | |
- name: (Optional) Install git-hours | |
run: npm install -g git-hours | |
- name: Generate latest report (optional) | |
run: git-hours --json > "reports/git-hours-$(date +%F).txt" | |
- name: Update README | |
run: python scripts/update_readme_hours.py | |
- name: Commit & push | |
env: | |
GIT_AUTHOR_NAME: "hours‑bot" | |
GIT_AUTHOR_EMAIL: "[email protected]" | |
GIT_COMMITTER_NAME: "hours‑bot" | |
GIT_COMMITTER_EMAIL: "[email protected]" | |
run: | | |
git add README.md reports/git-hours-*.txt | |
if ! git diff --cached --quiet; then | |
git commit -m "docs(readme): refresh contributor hours [skip ci]" | |
git push | |
fi |