name: Update music

on:
  schedule:
    - cron: '0 0 * * *'

jobs:
  build:

    runs-on: ubuntu-latest

    permissions:
      contents: write

    steps:
      - uses: actions/checkout@v3
      - name: Use PNPM
        uses: pnpm/action-setup@v4
        with:
          version: latest
          run_install: false
      - name: Install Node.js
        uses: actions/setup-node@v4
        with:
          node-version: latest
          cache: 'pnpm'
      - name: Install dependencies
        run: pnpm i
      - name: Update music mapping
        run: pnpm run music
      - name: Commit changes if any
        uses: stefanzweifel/git-auto-commit-action@v4
        with:
          commit_message: "chore(music): auto update mapping"