1
+ name : run github-traffic-stats
2
+
3
+ on :
4
+ workflow_dispatch : # Allow for running this manually.
5
+ schedule :
6
+ # runs daily at midnight (UTC)
7
+ - cron : ' 0 0 * * *'
8
+
9
+ jobs :
10
+ # This workflow contains a single job called "traffic"
11
+ traffic :
12
+ # The type of runner that the job will run on
13
+ runs-on : ubuntu-latest
14
+
15
+ # Steps represent a sequence of tasks that will be executed as part of the job
16
+ steps :
17
+ # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
18
+ - name : checkout repo content
19
+ uses : actions/checkout@v2
20
+ with :
21
+ ref : " traffic"
22
+
23
+ - name : setup python
24
+ uses : actions/setup-python@v4
25
+ with :
26
+ python-version : ' 3.10' # install the python version needed
27
+
28
+ - name : install python packages
29
+ run : |
30
+ python -m pip install --upgrade pip
31
+ pip install github_traffic_stats
32
+ pip install certifi==2017.7.27.1
33
+ pip install chardet==3.0.4
34
+ pip install idna==2.6
35
+ pip install pkginfo==1.4.2
36
+ pip install psycopg2-binary==2.7.4
37
+ pip install requests==2.21.0
38
+ pip install requests-toolbelt==0.8.0
39
+ pip install tqdm==4.19.2
40
+ pip install twine==1.11.0
41
+ pip install urllib3>=1.24.2
42
+
43
+ - name : execute py script # run main.py
44
+ env :
45
+ TRAFFIC_ACTION_TOKEN : ${{ secrets.TRAFFIC_ACTION_TOKEN }}
46
+ run : |
47
+ mkdir $(date +%Y-%m-%d)-traffic-stats
48
+ cd $(date +%Y-%m-%d)-traffic-stats
49
+ gts Ay1man2:${{ secrets.TRAFFIC_ACTION_TOKEN }} CRAIG save_csv -o IBM
50
+
51
+ - name : commit files
52
+ run : |
53
+ git config --local user.email "[email protected] "
54
+ git config --local user.name "GitHub Action"
55
+ git add -A
56
+ git diff-index --quiet HEAD || (git commit -a -m "daily traffic data uploaded" --allow-empty)
57
+
58
+ - name : push changes
59
+
60
+ with :
61
+ github_token : ${{ secrets.TRAFFIC_ACTION_TOKEN }}
62
+ branch : traffic
0 commit comments