Daily Game Notifications #494
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Daily Game Notifications | |
on: | |
schedule: | |
# * is a special character in YAML so you have to quote this string | |
# We'll run this daily at noon. | |
- cron: '0 10 * 4-9 * ' | |
workflow_dispatch: | |
jobs: | |
process-data: | |
runs-on: ubuntu-20.04 | |
steps: | |
# Shallow should be fine for video | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- uses: actions/setup-python@v2 | |
with: | |
python-version: '3.9' | |
architecture: 'x64' | |
- uses: actions/cache@v2 | |
with: | |
path: ~/.cache/pip | |
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} | |
restore-keys: | | |
${{ runner.os }}-pip- | |
- name: Install dependencies | |
run: | | |
pip install -r requirements.txt | |
pip install awscli | |
- name: Fetch Data | |
run: | | |
python what2watch.py | |
python what2watch.py --html --github-pages | |
- name: Commit | |
run: | | |
git config --global user.email "[email protected]" | |
git config --global user.name "Github Actions Bot" | |
git add data/ | |
git add docs/ | |
git commit -a -m 'Automated commit' | |
git push | |
continue-on-error: true | |
- name: Toot | |
run: | | |
python what2watch.py --toot | |
env: | |
FEDI_ACCESS_TOKEN: ${{ secrets.FEDI_ACCESS_TOKEN }} | |
- name: Email | |
run: | | |
aws ses send-email --destination "ToAddresses=${DISTRIBUTION_LIST}" --from [email protected] --subject 'MLB: What2Watch' --html "$(python what2watch.py --html)" | |
env: | |
AWS_ACCESS_KEY_ID: ${{ secrets.SES_ACCESS_KEY }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.SES_ACCESS_SECRET }} | |
AWS_DEFAULT_REGION: eu-central-1 | |
DISTRIBUTION_LIST: ${{ secrets.DISTRIBUTION_LIST }} |