-
-
Notifications
You must be signed in to change notification settings - Fork 410
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create a GitHub Actions workflow to automatically sync Peloton to Gar…
…min (#244) * Add workflow to sync to garmin * Update sync_peloton_to_garmin.yml * Update sync_peloton_to_garmin.yml * Update sync_peloton_to_garmin.yml * Fix exclude * Deploy to different docker repo * Fix workflow * Update docker tags * Add documentation * Change log level to Information * Use stable tag for sync workflow * Use full path for output * Update nav order * Fix missing quotes for schedule
- Loading branch information
Showing
9 changed files
with
126 additions
and
7 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
# This is a workflow that will automatically sync your Peloton rides with Garmin | ||
|
||
name: Sync workflow | ||
|
||
# Controls when the action will run. | ||
on: | ||
workflow_dispatch: | ||
inputs: | ||
workoutsToDownload: | ||
type: number | ||
default: "5" | ||
schedule: | ||
- cron: '0 1 * * *' | ||
|
||
jobs: | ||
sync: | ||
runs-on: ubuntu-latest | ||
# The type of runner that the job will run on | ||
container: | ||
image: philosowaffle/peloton-to-garmin:stable | ||
steps: | ||
- run: mkdir -p /app/output | ||
- name: Create device info file | ||
run: | | ||
cat <<EOT > /app/deviceInfo.xml | ||
${{secrets.DEVICE_INFO}} | ||
EOT | ||
- name: Create config file | ||
env: | ||
DEFAULT_WORKOUT_NUM: 5 | ||
run: | | ||
cat <<EOT > /app/configuration.local.json | ||
{ | ||
"App": { | ||
"OutputDirectory": "/app/output", | ||
"EnablePolling": false, | ||
"CloseWindowOnFinish": true | ||
}, | ||
"Format": { | ||
"Fit": true, | ||
"Json": false, | ||
"Tcx": false, | ||
"SaveLocalCopy": false, | ||
"IncludeTimeInHRZones": false, | ||
"IncludeTimeInPowerZones": false, | ||
"DeviceInfoPath": "./deviceInfo.xml" | ||
}, | ||
"Peloton": { | ||
"NumWorkoutsToDownload": ${{ github.event.inputs.workoutsToDownload || env.DEFAULT_WORKOUT_NUM }}, | ||
"ExcludeWorkoutTypes": [ "meditation" ], | ||
}, | ||
"Garmin": { | ||
"Upload": true, | ||
"FormatToUpload": "fit", | ||
"UploadStrategy": 2 | ||
}, | ||
"Observability": { | ||
"Prometheus": { | ||
"Enabled": false | ||
}, | ||
"Jaeger": { | ||
"Enabled": false | ||
}, | ||
"Serilog": { | ||
"Using": [ "Serilog.Sinks.Console"], | ||
"MinimumLevel": "Information", | ||
"WriteTo": [ | ||
{ "Name": "Console" } | ||
] | ||
} | ||
} | ||
} | ||
EOT | ||
- run: /app/PelotonToGarminConsole | ||
working-directory: /app | ||
env: | ||
P2G_PELOTON__EMAIL: ${{ secrets.P2G_PELOTON__EMAIL }} | ||
P2G_PELOTON__PASSWORD: ${{ secrets.P2G_PELOTON__PASSWORD }} | ||
P2G_GARMIN__EMAIL: ${{ secrets.P2G_GARMIN__EMAIL }} | ||
P2G_GARMIN__PASSWORD: ${{ secrets.P2G_GARMIN__PASSWORD }} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -120,3 +120,4 @@ configuration.local.json | |
/Output | ||
/src/PelotonToGarminConsole/data | ||
/src/WebApp/data | ||
/.vs/ProjectSettings.json |
Binary file not shown.
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
--- | ||
layout: default | ||
title: Using the Github Action | ||
nav_order: 2 | ||
has_children: false | ||
--- | ||
|
||
# Github Actions | ||
|
||
A Github Actions workflow exists that can be used to automatically sync your rides on a schedule (by default once a day) | ||
|
||
## Getting started | ||
|
||
The easiest way to use the action is to simply create a fork of the repo using the `Fork` button. | ||
|
||
## Secrets | ||
|
||
Once you've created your fork, you'll need to set a number of secrets in your repository. | ||
|
||
You can set secrets by clicking the `Settings` tab in your fork. Then, on the side nav, select `Secrets` and then `Actions`. | ||
|
||
From this point on you can add secrets by clicking the `New repository secret` button at the top right. | ||
|
||
| Secret Name | Value | | ||
|:-----------------|:------------------| | ||
| `P2G_PELOTON__EMAIL` | The email address you use to login to Peloton | | ||
| `P2G_PELOTON__PASSWORD` | The password that you use to login to Peloton | | ||
| ` P2G_GARMIN__EMAIL` | The email address that you use to login to Garmin | | ||
| `P2G_GARMIN__PASSWORD` |The password that you use to log into Garmin | | ||
| `DEVICE_INFO` | The contents of the deviceInfo.xml that you want to use for the sync | | ||
|
||
## Starting the workflow | ||
|
||
Once you've configured your secrets, you can then navigate to the `Actions` tab within your repository. Enable actions for your fork. You can now run the `Sync workflow` manually, or have it automatically run on the schedule set by the `cron` line in the `./github/workflows/sync_peloton_to_garmin.yml` file. | ||
|
||
## Additional Notes | ||
|
||
If you're doing more than 5 runs a day, you will need to change the default number of workouts downloaded as part of the workflow. |
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
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
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