Skip to content

Earthquake Toot & Tweet workflow #9787

Earthquake Toot & Tweet workflow

Earthquake Toot & Tweet workflow #9787

Workflow file for this run

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