.github/workflows/fetch_strava.yml #377
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: Miles Retrieval | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: '0 6 * * *' | |
jobs: | |
update: | |
runs-on: ubuntu-latest | |
steps: | |
- name: check out repo | |
uses: actions/checkout@v2 | |
- name: use node | |
uses: actions/setup-node@v2 | |
with: | |
node-version: '18.x' | |
- name: install node dependencies | |
run: npm ci | |
- name: get miles | |
run: npm run update-ytd-distance | |
id: miles | |
env: | |
STRAVA_CLIENT_SECRET: ${{ secrets.STRAVA_CLIENT_SECRET }} | |
STRAVA_REFRESH_TOKEN: ${{ secrets.STRAVA_REFRESH_TOKEN }} | |
- name: update file | |
run: echo "$TOTAL_MILES" > ./docs/data.json | |
env: | |
TOTAL_MILES: ${{ steps.miles.outputs.TOTAL_MILES }} | |
- name: commit changed file | |
uses: EndBug/add-and-commit@v7 | |
with: | |
add: './docs/data.json' | |
message: 'Update total miles in data.json file' | |
# - name: Fetch data | |
# uses: JamesIves/fetch-api-data-action@v2 | |
# with: | |
# debug: true | |
# token-endpoint: https://www.strava.com/api/v3/oauth/token | |
# token-configuration: '{ "method":"POST", "headers": {"Accept": "application/json", "Content-Type": "application/json"}, "body": {"client_id": "99458", "client_secret": "${{ secrets.STRAVA_CLIENT_SECRET }}", "refresh_token": "${{ secrets.STRAVA_REFRESH_TOKEN }}", "grant_type": "refresh_token"} }' | |
# endpoint: https://www.strava.com/api/v3/athletes/49030731/stats | |
# configuration: '{ "method": "GET", "headers": {"Authorization": "Bearer {{{ data.access_token }}}"} }' |