Skip to content

Ingest

Ingest #1392

Workflow file for this run

name: Ingest
on:
workflow_dispatch:
inputs:
after:
description: 'After date'
type: string
before:
description: 'Before date'
type: string
schedule:
- cron: "0 5 * * *"
jobs:
ingest:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18
cache: "npm"
- run: npm ci
- name: Ingest Strava Activities
env:
STRAVA_ACCESS_TOKEN: ${{ secrets.STRAVA_ACCESS_TOKEN }}
STRAVA_AFTER: ${{ github.event.inputs.after }}
STRAVA_BEFORE: ${{ github.event.inputs.before }}
run: node dist/strava-ingest.mjs
- name: Ingest Strava Activities (random)
env:
STRAVA_ACCESS_TOKEN: ${{ secrets.STRAVA_ACCESS_TOKEN }}
run: |
YEAR=$(shuf -i 2020-$(date +%Y) -n 1)
MONTH=$(shuf -i 1-12 -n 1)
DAY=$(shuf -i 1-$(date -d "$YEAR-$MONTH-01 +1 month -1 day" +%d) -n 1)
echo "Ingesting data from $YEAR-$MONTH-$DAY"
STRAVA_AFTER="$YEAR-$MONTH-$DAY"
STRAVA_BEFORE=$(date -d "$YEAR-$MONTH-$DAY +10 day" +%Y-%m-%d)
echo "STRAVA_AFTER=$STRAVA_AFTER"
echo "STRAVA_BEFORE=$STRAVA_BEFORE"
node dist/strava-ingest.mjs
#- name: Ingest NPM Packages
# run: node dist/npm.mjs
# - name: Ingest Mastodon
# run: node dist/mastodon.mjs
- run: |
curl -L https://script.google.com/macros/s/$APPS_SCRIPT_RUNTIME_DEPLOYMENT_ID/exec -o src/_data/appsScriptWinterCG.json
env:
APPS_SCRIPT_RUNTIME_DEPLOYMENT_ID: ${{ secrets.APPS_SCRIPT_RUNTIME_DEPLOYMENT_ID }}
- run: |
git status
git add --all src/_data/
- name: Commit changes
if: github.ref == 'refs/heads/main'
run: |
git config --local user.email "[email protected]"
git config --local user.name "Justin Poehnelt"
git commit -m "chore: update data" || true
git push