Generate Lesson Statistics #4773
This file contains 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: Generate Lesson Statistics | |
on: | |
push: | |
branches: main | |
schedule: | |
- cron: '45 */6 * * *' | |
workflow_dispatch: | |
inputs: | |
name: | |
description: 'Who triggered this build?' | |
required: true | |
default: 'scheduled build' | |
jobs: | |
build-website: | |
if: github.repository_owner == 'carpentries-incubator' | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
shell: bash | |
steps: | |
- name: Checkout the Repository | |
uses: actions/checkout@v2 | |
- name: Run stats script | |
if: ${{ github.ref == 'refs/heads/main' }} | |
run: | | |
python bin/get_lesson_stats.py ${{ secrets.PAT_USERNAME }} ${{ secrets.PAT }} > _data/lesson-stats.yml | |
git config --local user.email "[email protected]" | |
git config --local user.name "GitHub Actions" | |
git pull origin main | |
git add _data/lesson-stats.yml | |
git commit -m "[Github Actions] update lesson stats (via ${{ github.sha }})" || echo "Nothing to commit" | |
git push origin main |