Pull Playlist #1108
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
name: "Pull Playlist" | |
on: | |
workflow_dispatch: {} | |
schedule: | |
- cron: "0 4 * * *" # daily at 04:00 UTC | |
jobs: | |
playlistPull: | |
name: "Pull Spotify Playlist and commit on repository" | |
runs-on: ubuntu-latest | |
steps: | |
- name: "Checkout" | |
uses: actions/checkout@master | |
with: | |
fetch-depth: 1 | |
- name: "Setup Python" | |
uses: actions/setup-python@master | |
with: | |
python-version: "3.8" | |
architecture: "x64" | |
- name: "Cache Python packages" | |
uses: actions/cache@v2 | |
with: | |
key: "python_cache_base-${{ hashFiles('**/spotify_client/requirements.txt') }}" | |
path: | | |
~/.cache/pip | |
~/.local/lib/python3.8/site-packages | |
- name: "Install Python requirements" | |
run: pip install --user -r spotify_client/requirements.txt | |
- name: Run | |
run: python run_spotify_client.py pull | |
env: | |
SPOTIFY_CLIENT_ID: ${{ secrets.SPOTIFY_CLIENT_ID }} | |
SPOTIFY_CLIENT_SECRET: ${{ secrets.SPOTIFY_CLIENT_SECRET }} | |
SPOTIFY_REFRESH_TOKEN: ${{ secrets.SPOTIFY_REFRESH_TOKEN }} | |
SPOTIFY_PLAYLIST_ID: ${{ secrets.SPOTIFY_PLAYLIST_ID }} | |
PLAYLIST_FILE: playlist.tsv | |
- name: Git Commit & Push | |
uses: EndBug/add-and-commit@v7 | |
with: | |
add: "playlist.tsv" | |
message: "Update playlist from Spotify" | |
push: true |