-
Notifications
You must be signed in to change notification settings - Fork 0
36 lines (31 loc) · 1.24 KB
/
trakt.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
name: Trakt
on:
schedule:
- cron: "0 0 1 * *"
workflow_dispatch:
jobs:
refresh:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Refresh Trakt token
run: |
curl --silent --fail \
-X POST \
-F "client_id=$TRAKT_CLIENT_ID" \
-F "client_secret=$TRAKT_CLIENT_SECRET" \
-F "refresh_token=$TRAKT_REFRESH_TOKEN" \
-F "grant_type=refresh_token" \
'https://api.trakt.tv/oauth/token' >token.json
env:
TRAKT_CLIENT_ID: ${{ secrets.TRAKT_CLIENT_ID }}
TRAKT_CLIENT_SECRET: ${{ secrets.TRAKT_CLIENT_SECRET }}
TRAKT_REFRESH_TOKEN: ${{ secrets.TRAKT_REFRESH_TOKEN }}
- name: Update GitHub secrets
run: |
jq --raw-output '.access_token' token.json | gh secret set --app actions TRAKT_ACCESS_TOKEN
jq --raw-output '.access_token' token.json | gh secret set --app codespaces TRAKT_ACCESS_TOKEN
jq --raw-output '.refresh_token' token.json | gh secret set --app actions TRAKT_REFRESH_TOKEN
jq --raw-output '.refresh_token' token.json | gh secret set --app codespaces TRAKT_REFRESH_TOKEN
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}