Update Stats #554
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: Update Stats | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: '46 15 * * *' | |
jobs: | |
build: | |
permissions: write-all | |
runs-on: macos-latest | |
steps: | |
- name: install gdal | |
run: brew install gdal --force --overwrite | |
- name: get current date and time | |
run: echo "RUN=$(date +'%Y-%m-%dT%H:%M:%S')" >> $GITHUB_ENV | |
- name: checkout repo | |
uses: actions/checkout@v2 | |
- name: setup python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.10.11' | |
- name: install python packages | |
run: | | |
python -m pip install --upgrade pip | |
pip install gdal==3.6.4 | |
pip install -r ./.github/requirements.txt | |
- name: execute python script | |
env: | |
SITE: navendu.me | |
PERIOD: 30d | |
TOKEN: ${{ secrets.PLAUSIBLE_TOKEN }} | |
run: python ./.github/main.py | |
# run fetchCommits.js and commit just the generated commitsData.json file | |
- name: fetch commits | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
npm install --prefix ./.github | |
node ./.github/fetchCommits.js | |
- name: commit files | |
run: | | |
git config --local user.email "github-actions[bot]@users.noreply.github.com" | |
git config --local user.name "github-actions[bot]" | |
git add -A | |
git diff-index --quiet HEAD || (git commit -a -m "update stats" --allow-empty) | |
- name: push changes | |
uses: ad-m/[email protected] | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
branch: hugo |