Skip to content

Dataset Updates

Dataset Updates #547

name: Dataset Updates
on:
schedule:
# Runs once a day at midnight UTC
- cron: '0 0 * * *'
jobs:
get_updates:
permissions:
id-token: 'write'
contents: 'write'
actions: 'write'
runs-on: 'ubuntu-latest'
steps:
- name: 'Check out the repo'
uses: 'actions/checkout@v2'
with:
token: ${{secrets.GH_ACTION_PAT}}
- id: 'auth'
name: 'Authenticate to Google Cloud'
uses: 'google-github-actions/auth@v0'
with:
create_credentials_file: true
workload_identity_provider: ${{ secrets.WORKLOAD_IDENTITY_PROVIDER }}
service_account: ${{ secrets.GOOGLE_SERVICE_ACCOUNT }}
- name: 'Run trainingData.js script'
id: 'results'
run: |
cd client
npm i googleapis --silent
cd scripts
export CREDENTIALS_PATH=${{ steps.auth.outputs.credentials_file_path }}
export SPREADSHEET_RANGE=${{ secrets.SPREADSHEET_RANGE }}
export SPREADSHEET_ID=${{ secrets.SPREADSHEET_ID }}
node trainingData.js
- name: 'Get current date'
id: 'date'
run: echo "::set-output name=today::$(date +'%Y-%m-%d')"
- name: 'Commit updated file'
run: |
if ! git diff --exit-code; then
git config --global user.name 'nathanfletcher'
git config --global user.email 'nathanfletcher@users.noreply.github.com'
git remote set-url origin https://x-access-token:${{ secrets.GH_ACTION_PAT }}@github.com/unicef/kindly
git add ./modeling/dataset/training_data.json
git commit -am "Updated training data - ${{ steps.date.outputs.today }}"
git push
fi