Update API User Usage #6002
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 API User Usage | |
on: | |
schedule: | |
# Run every 4 hours at the top of the hour | |
- cron: '0 */6 * * *' | |
env: | |
# !!! Change this to your BRANCH if you want to test it | |
COVID_DATA_MODEL_REF: 'main' | |
# To pin to an old data sets, put the branch/tag/commit here: | |
COVID_DATA_PUBLIC_REF: 'main' | |
# Used by python code that reports errors to sentry. | |
SENTRY_DSN: ${{ secrets.SENTRY_DSN }} | |
SENTRY_ENVIRONMENT: 'production' | |
# use a webhook to write to slack channel dev-alerts for QA | |
SLACK_DEV_ALERTS_WEBHOOK: ${{ secrets.SLACK_DEV_ALERTS_WEBHOOK }} | |
# Google sheet id to update | |
API_USERS_SHEET_ID: ${{ secrets.API_USERS_SHEET_ID }} | |
API_TABLE_NAME: ${{ secrets.API_TABLE_NAME }} | |
API_DATABASE_NAME: ${{ secrets.API_DATABASE_NAME }} | |
GOOGLE_SHEETS_SERVICE_ACCOUNT_DATA: ${{ secrets.GOOGLE_SHEETS_SERVICE_ACCOUNT_DATA }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.API_USAGE_UPDATER_SECRET_ACCESS_KEY }} | |
AWS_ACCESS_KEY_ID: ${{ secrets.API_USAGE_UPDATER_ACCESS_KEY_ID }} | |
HUBSPOT_AUTH_TOKEN: ${{ secrets.HUBSPOT_AUTH_TOKEN }} | |
jobs: | |
update-and-promote-datasets: | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Checkout covid-data-model | |
uses: actions/checkout@v2 | |
with: | |
repository: act-now-coalition/covid-data-model | |
path: covid-data-model | |
ref: '${{env.COVID_DATA_MODEL_REF}}' | |
lfs: true | |
- name: Setup Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.10' | |
- name: Install Dependencies | |
run: | | |
pip install -r requirements.txt | |
working-directory: ./covid-data-model | |
- name: Update API User Usage sheet | |
working-directory: ./covid-data-model | |
env: | |
AWS_DEFAULT_REGION: us-east-1 | |
run: | | |
./run.py utils update-api-user-usage | |
- name: Slack notification | |
if: failure() | |
env: | |
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_DEV_ALERTS }} | |
STATUS: ${{job.status}} | |
uses: Ilshidur/action-slack@fb92a78a305a399cd6d8ede99d641f2b9224daf3 | |
with: | |
args: 'Update API usage failed' |