-
-
Notifications
You must be signed in to change notification settings - Fork 384
105 lines (100 loc) · 3.27 KB
/
sync_peloton_to_garmin.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
# 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"
saveLocalCopy:
type: boolean
default: false
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:
- name: Set env
run: echo "OUTPUT_DIR=/app/output" >> $GITHUB_ENV
- run: mkdir -p ${{ env.OUTPUT_DIR }}
- name: Create device info file
env:
DEVICE_INFO: ${{ secrets.DEVICE_INFO }}
if: ${{ env.DEVICE_INFO }}
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": ${{ github.event.inputs.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
if: ${{ env.P2G_PELOTON__EMAIL && env.P2G_PELOTON__PASSWORD && env.P2G_GARMIN__EMAIL && env.P2G_GARMIN__PASSWORD }}
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 }}
TZ: America/Chicago
- name: archive files
# saveLocalCopy can be set when workflow action is manually run otherwise it's always skipped
if: ${{ github.event.inputs.saveLocalCopy == 'true' }}
run: |
apt-get update
apt-get install -y zip
zip -r -j output.zip ${{ env.OUTPUT_DIR }}
- uses: actions/upload-artifact@v3
if: ${{ github.event.inputs.saveLocalCopy == 'true' }}
with:
name: output
path: output.zip
if-no-files-found: error