Pull Airtable Data #40
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: Pull Airtable Data | |
on: | |
release: | |
types: | |
- published | |
schedule: | |
- cron: '30 6 2 * *' | |
jobs: | |
fetch_and_save: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
ref: master | |
- uses: actions/setup-node@v1 | |
with: | |
node-version: 18 | |
- name: npm install | |
run: npm ci | |
- name: Fetch data from Airtable API | |
run: | | |
OUTPUT_FILE_NAME=data_`date +%s`.json | |
npm run --silent airtable | tee data/$OUTPUT_FILE_NAME | |
ln -sf $OUTPUT_FILE_NAME data/latest.json | |
env: | |
AIRTABLE_API_KEY: ${{ secrets.AIRTABLE_API_KEY }} | |
AIRTABLE_BASE_ID: ${{ secrets.AIRTABLE_BASE_ID }} | |
- name: Check Link Responses | |
run: | | |
LINK_OUTPUT_FILE_NAME=reports_`date +%s`.md | |
npm run --silent linkcheck | tee link_reports/$LINK_OUTPUT_FILE_NAME | |
ln -sf $LINK_OUTPUT_FILE_NAME link_reports/latest.md | |
- name: Push changes to repo | |
run: | | |
git config user.email "${{ github.actor }}@users.noreply.github.com" | |
git config user.name "${{ github.actor }}" | |
git add data/$OUTPUT_FILE_NAME data/latest.json | |
git add link_reports/$LINK_OUTPUT_FILE_NAME link_reports/latest.md | |
git status | |
git commit -m "Triggered automated Airtable data fetch via release on $(date)" | |
git push |