Update Teaching Resources from Airtable #872
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: Update Teaching Resources from Airtable | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: '57 4 * * *' | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out repo | |
uses: actions/checkout@v2 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: 3.8 | |
- uses: actions/cache@v2 | |
name: Configure pip caching | |
with: | |
path: ~/.cache/pip | |
key: ${{ runner.os }}-pip- | |
restore-keys: | | |
${{ runner.os }}-pip- | |
- name: Install airtable-export | |
run: | | |
pip install airtable-export | |
- name: Get YAML from Airtable to data/education/ | |
env: | |
AIRTABLE_BASE_ID: ${{ secrets.AIRTABLE_BASE_ID }} | |
AIRTABLE_KEY: ${{ secrets.AIRTABLE_KEY }} | |
AIRTABLE_TABLES: ${{ secrets.AIRTABLE_TABLES }} | |
run: |- | |
airtable-export data/education $AIRTABLE_BASE_ID $AIRTABLE_TABLES -v | |
- name: Commit and push if it changed | |
run: |- | |
git config user.name "Automated" | |
git config user.email "actions@users.noreply.github.com" | |
git add -A | |
timestamp=$(date -u) | |
git commit -m "Latest data: ${timestamp}" || exit 0 | |
git push |