Skip to content

Export playlists on a schedule #1

Export playlists on a schedule

Export playlists on a schedule #1

name: Save seasonal or any playlist
on:
# Run every three months on the 20th to get the seasonal playlist
schedule:
- cron: "00 01 20 Mar,Jun,Sep,Dec *"
# Run on demand to get any playlist
workflow_dispatch:
inputs:
playlist-name:
description: Your Spotify playlist name that you want to export.
type: string
permissions:
contents: write
jobs:
spotify-to-yaml:
runs-on: ubuntu-latest
name: Save Spotify playlist and thumbnail
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Save the playlist
uses: ./
with:
spotify-username: "katydecorah"
env:
SpotifyClientID: ${{ secrets.SpotifyClientID }}
SpotifyClientSecret: ${{ secrets.SpotifyClientSecret}}
SpotifyUser: ${{ secrets.SpotifyUser }}
- name: Save the thumbnail
run: curl "${{ env.PlaylistImage }}" -o "img/playlists/${{ env.PlaylistImageOutput }}"
- name: Commit files
run: |
git pull
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git add -A && git commit -m "🎵 ${{ env.playlist }}"
git push