Skip to content

Commit 2d9e791

Browse files
committed
Add GitHub workflow to refresh the CI account token
1 parent 5a0d147 commit 2d9e791

File tree

1 file changed

+56
-0
lines changed

1 file changed

+56
-0
lines changed
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: Refresh CI Plex Account Token
2+
3+
on:
4+
workflow_dispatch: ~
5+
schedule:
6+
- cron: '52 04 * * *'
7+
8+
env:
9+
CACHE_VERSION: 1
10+
DEFAULT_PYTHON: 3.9
11+
12+
jobs:
13+
refresh-token:
14+
name: Refresh Token
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Check out code from Github
18+
uses: actions/checkout@v4
19+
20+
- name: Set up Python ${{ env.DEFAULT_PYTHON }}
21+
id: python
22+
uses: actions/setup-python@v5
23+
with:
24+
python-version: ${{ env.DEFAULT_PYTHON }}
25+
26+
- name: Restore Python ${{ steps.python.outputs.python-version }} virtual environment
27+
id: cache-venv
28+
uses: actions/cache@v4
29+
with:
30+
path: venv
31+
key: >-
32+
${{ env.CACHE_VERSION }}-${{ runner.os }}-venv-${{
33+
steps.python.outputs.python-version }}-${{
34+
hashFiles('requirements_dev.txt') }}
35+
restore-keys: >-
36+
${{ env.CACHE_VERSION }}-${{ runner.os }}-venv-${{
37+
steps.python.outputs.python-version }}-
38+
39+
- name: Create Python virtual environment
40+
if: steps.cache-venv.outputs.cache-hit != 'true'
41+
run: |
42+
python -m venv venv
43+
. venv/bin/activate
44+
pip install -U pip
45+
pip install -r requirements_dev.txt
46+
pip install -e .
47+
48+
- name: Set Plex credentials
49+
run: |
50+
echo "PLEXAPI_AUTH_SERVER_TOKEN=${{ secrets.PLEXAPI_AUTH_SERVER_TOKEN }}" >> $GITHUB_ENV
51+
52+
- name: Refresh account token
53+
run: |
54+
. venv/bin/activate
55+
python \
56+
-u tools/plex-refreshtoken.py

0 commit comments

Comments
 (0)