-
Notifications
You must be signed in to change notification settings - Fork 1
62 lines (58 loc) · 2.25 KB
/
update_stats.yaml
File metadata and controls
62 lines (58 loc) · 2.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
name: Update Stats
on:
schedule:
# * is a special character in YAML so you have to quote this string
- cron: "0 1 * * *" # Update once a day, now, that the project is not active
push:
branches: [master]
paths:
- '.github/workflows/update_stats.yaml'
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
path: master
ref: master
- name: Checkout repository
uses: actions/checkout@v2
with:
path: gh-pages
ref: gh-pages
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ secrets.AWS_DEFAULT_REGION }}
# role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }}
# role-external-id: ${{ secrets.AWS_ROLE_EXTERNAL_ID }}
# role-duration-seconds: 1200
# role-session-name: MySessionName
- uses: actions/setup-python@v2
with:
python-version: '3.9'
- name: Fetch logs
working-directory: master
run: "pip install -r requirements.txt && aws logs tail /aws/lambda/FuelFinder --since 3h | grep '{\"id\"' | cut -f 3- -d ' ' | python data/create_json.py update-stats fuelfinder/public/stations.json"
- name: Push stations.json to gh-pages and master
working-directory: gh-pages
run: |
git config --global user.name $user_name
git config --global user.email $user_email
git remote set-url origin https://${github_token}@github.com/${repository}
cp ../master/fuelfinder/public/stations.json .
git add stations.json
git commit -m "Automated update"
git push origin HEAD
cd ../master/
git add fuelfinder/public/stations.json
git commit -m "Automated update"
git push origin HEAD
env:
user_name: "github-actions[bot]"
user_email: "github-actions[bot]@users.noreply.github.com"
github_token: ${{ secrets.ACTIONS_DEPLOY_ACCESS_TOKEN }}
repository: ${{ github.repository }}