-
Notifications
You must be signed in to change notification settings - Fork 0
50 lines (42 loc) · 1.63 KB
/
status_update.yml
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
name: Earthquake Toot & Tweet workflow
on:
workflow_dispatch:
schedule:
- cron: "0 * * * *"
jobs:
toot:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install dependencies
run: |-
cd /home/runner/work/vancouver_earthquake/vancouver_earthquake
python3 -m pip install --upgrade Pillow
pip3 install Mastodon.py
pip3 install tweepy
- name: Run tests
run: |-
cd /home/runner/work/vancouver_earthquake/vancouver_earthquake/
python3 -m unittest discover
- name: Post earthquake and map into Mastodon
run: |-
cd /home/runner/work/vancouver_earthquake/vancouver_earthquake/
python3 main.py
env:
ACCOUNT_EMAIL: ${{ secrets.ACCOUNT_EMAIL }}
PASSWORD: ${{ secrets.PASSWORD }}
MASTODON_SERVER: ${{ secrets.MASTODON_SERVER }}
TW_BEARER_TOKEN: ${{ secrets.TW_BEARER_TOKEN }}
TW_API_KEY: ${{ secrets.TW_API_KEY }}
TW_API_KEY_SECRET: ${{ secrets.TW_API_KEY_SECRET }}
TW_USER_ACCESS_TOKEN: ${{ secrets.TW_USER_ACCESS_TOKEN }}
TW_USER_ACCESS_TOKEN_SECRET: ${{ secrets.TW_USER_ACCESS_TOKEN_SECRET }}
- name: Commit and push if api changed
run: |-
cd /home/runner/work/vancouver_earthquake/vancouver_earthquake/
git config user.name "Automated"
git config user.email "actions@users.noreply.github.com"
git add outputs/old_earthquake.json
timestamp=$(date -u)
git commit -m "Latest response from earthquake.usgs.gov: ${timestamp}" || exit 0
git push