Skip to content

A workflow to automate updating download stats using Google Analytics 4 #38

A workflow to automate updating download stats using Google Analytics 4

A workflow to automate updating download stats using Google Analytics 4 #38

Workflow file for this run

name: A workflow to automate updating download stats using Google Analytics 4
on:
schedule:
- cron: "0 1 1 * *"
workflow_dispatch:
inputs:
runMessage:
description: "Update Google Analytics"
required: true
default: "Testing"
jobs:
graph:
name: Google Analytics 4 Update
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: "3.8"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Execute Python script
env:
GA4_ACCOUNT_CRED: ${{ secrets.GA4_ACCOUNT_CRED }}
run: |
python data/google_analytics.py
- name: Get current date
id: date
run: echo "::set-output name=date::$(date +'%Y-%m-%d')"
- name: Push changes to GitHub
run: |
git config --local user.email "[email protected]"
git config --local user.name "Xun Li"
git pull
git add data/download_data.json data/globe_log.json data/down_by_country.csv
git commit -m "Updated google analytics stats ${{ steps.date.outputs.date }}"
git push origin master