-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add workflow to refresh trakt oauth token
- Loading branch information
Showing
1 changed file
with
36 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,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 }} |