joshghent / spotify-to-yaml-action

🎡 A Github Action to export a seasonal Spotify playlist to YAML.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

spotify-to-yaml-action

Export a seasonal Spotify playlist to YAML.

At the end of each season, the workflow will fetch last season's playlists, add the the contents to _data/playlist.yml and save the playlist thumbnail image to the repository.

Set up

This workflow requires that you name your Spotify playlists using the following format: YYYY {season}. Examples:

  • 2021 Fall
  • 2021/2022 Winter
  • 2022 Spring
  • 2022 Summer

You must also set the following secrets to your repository to connect to Spotify. You can find these values from the Spotify API dashboard:

  • SpotifyClientID
  • SpotifyClientSecret

Set up the workflow

To use this action, create a new workflow in .github/workflows and modify it as needed:

name: Save Spotify playlist
on:
  schedule:
    - cron: "00 01 20 Mar,Jun,Sep,Dec *"

jobs:
  spotify_to_jekyll:
    runs-on: macOS-latest
    name: Save Spotify playlist and thumbnail
    steps:
      - name: Checkout
        uses: actions/checkout@v3
      - name: Save the playlist
        uses: katydecorah/spotify-to-yaml-action@v7.0.0
        with:
          spotifyUser: "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 config --local user.email "action@github.com"
          git config --local user.name "GitHub Action"
          git add -A && git commit -m "🎡 ${{ env.playlist }}"
          git push

Action options

  • spotifyUser: Required. Your Spotify username.

  • fileName: The YAML file to write your playlists. Default: _data/playlists.yml.

About

🎡 A Github Action to export a seasonal Spotify playlist to YAML.


Languages

Language:TypeScript 97.8%Language:JavaScript 1.9%Language:Shell 0.3%