Update Course Data #225
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 Course Data | |
on: | |
schedule: | |
- cron: '0 2 * * *' | |
workflow_dispatch: | |
permissions: | |
contents: write | |
pull-requests: write | |
jobs: | |
update-data: | |
# Adapted from https://github.com/StoDevX/AAO-React-Native/blob/master/.github/workflows/cocoapods.yml | |
name: Course Data Update | |
runs-on: ubuntu-latest | |
timeout-minutes: 60 | |
strategy: | |
matrix: | |
python-version: ["3.7"] | |
steps: | |
- name: Generate token | |
id: generate_token | |
uses: actions/create-github-app-token@v1 | |
with: | |
app-id: ${{ secrets.COURSE_DATA_BOT_APP_ID }} | |
private-key: ${{ secrets.COURSE_DATA_BOT_APP_PEM }} | |
installation-id: ${{ github.event.installation.id }} | |
- uses: actions/checkout@v3 | |
with: | |
token: ${{ steps.generate_token.outputs.token }} | |
- name: Start check-in | |
if: github.event_name == 'schedule' | |
run: bash bin/monitor.sh start | |
env: | |
SENTRY_DSN: ${{ secrets.COURSE_DATA_TOOLS_GH_SENTRY_DSN }} | |
TARGET_ENV: 'production' | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
cache: 'pip' | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt | |
- name: push-on-course-data-change | |
run: bash bin/github.sh | |
env: | |
GITHUB_BRANCH: ${{ github.ref_name }} | |
head_ref: ${{ github.ref }} | |
GH_TOKEN: ${{ steps.generate_token.outputs.token }} | |
- name: Finish check-in | |
if: github.event_name == 'schedule' | |
run: bash bin/monitor.sh stop | |
env: | |
SENTRY_DSN: ${{ secrets.COURSE_DATA_TOOLS_GH_SENTRY_DSN }} | |
TARGET_ENV: 'production' | |
- name: Check for errors | |
if: github.event_name == 'schedule' && failure() | |
run: bash bin/monitor.sh fail | |
env: | |
SENTRY_DSN: ${{ secrets.COURSE_DATA_TOOLS_GH_SENTRY_DSN }} | |
TARGET_ENV: 'production' |