Skip to content

Commit 70f38f3

Browse files
committed
upgrade script to google analytics 4
1 parent 6f71507 commit 70f38f3

File tree

6 files changed

+322
-506
lines changed

6 files changed

+322
-506
lines changed

.github/workflows/main.yml

Lines changed: 15 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,66 +1,42 @@
1-
name: A workflow to automate downloads graph and globe updates
1+
name: A workflow to automate updating download stats using Google Analytics 4
22

33
on:
44
schedule:
5-
- cron: '0 1 1 * *'
5+
- cron: "0 1 1 * *"
66
workflow_dispatch:
77
inputs:
88
runMessage:
9-
description: 'Run Message'
9+
description: "Update Google Analytics"
1010
required: true
11-
default: 'Testing'
11+
default: "Testing"
1212

1313
jobs:
1414
graph:
15-
name: Downloads Graph Update
15+
name: Google Analytics 4 Update
1616
runs-on: ubuntu-latest
1717
steps:
1818
- uses: actions/checkout@v2
1919
- name: Set up Python
2020
uses: actions/setup-python@v2
2121
with:
22-
python-version: '3.x'
22+
python-version: "3.8"
2323
- name: Install dependencies
2424
run: |
2525
python -m pip install --upgrade pip
2626
pip install -r requirements.txt
2727
- name: Execute Python script
2828
env:
29-
ACCOUNT_INFO: ${{ secrets.CLIENT_SECRETS }}
29+
GA4_ACCOUNT_CRED: ${{ secrets.GA4_ACCOUNT_CRED }}
3030
run: |
31-
python data/download_update.py
31+
python data/google_analytics.py
32+
- name: Get current date
33+
id: date
34+
run: echo "::set-output name=date::$(date +'%Y-%m-%d')"
3235
- name: Push changes to GitHub
3336
run: |
34-
git config --local user.email "bzlbzlbzl2000iscool@gmail.com"
35-
git config --local user.name "Bzlbzlbzl"
37+
git config --local user.email "lixun910@gmail.com"
38+
git config --local user.name "Xun Li"
3639
git pull
37-
git add data/download_data.json
38-
git commit -m "Updated downloads graph for last month"
39-
git push origin master
40-
globe:
41-
needs: graph
42-
name: Downloads Globe Update
43-
runs-on: ubuntu-latest
44-
steps:
45-
- uses: actions/checkout@v2
46-
- name: Set up Python
47-
uses: actions/setup-python@v2
48-
with:
49-
python-version: '3.x'
50-
- name: Install dependencies
51-
run: |
52-
python -m pip install --upgrade pip
53-
pip install -r requirements.txt
54-
- name: Execute Python script
55-
env:
56-
ACCOUNT_INFO: ${{ secrets.CLIENT_SECRETS }}
57-
run: |
58-
python data/globe_update.py
59-
- name: Push changes to GitHub
60-
run: |
61-
git config --local user.email "[email protected]"
62-
git config --local user.name "Bzlbzlbzl"
63-
git pull
64-
git add data/globe_log.json data/down_by_country.csv
65-
git commit -m "Updated downloads globe for last month"
40+
git add data/download_data.json data/globe_log.json data/down_by_country.csv
41+
git commit -m "Updated google analytics stats ${{ steps.date.outputs.date }}"
6642
git push origin master

.gitignore

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33

44
.DS_Store
55

6-
*.py
7-
86
data/GeoDa-Github-Website-2bd8df3fe4f2.p12
97

108
logs/*

data/download_update.py

Lines changed: 0 additions & 222 deletions
This file was deleted.

0 commit comments

Comments
 (0)