Import songs #144
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: 'Import songs' | |
on: | |
workflow_dispatch: | |
inputs: | |
user_id: | |
description: 'PostHog user IDs (comma separated) to import songs from' | |
required: true | |
default: '' | |
days_from: | |
description: 'The days from which to import songs. `2` (so NOW - 48h) by default' | |
required: false | |
default: '' | |
days_to: | |
description: 'The days to which to import songs' | |
required: false | |
default: '' | |
schedule: | |
- cron: '0 0 */2 * *' | |
jobs: | |
run_script: | |
permissions: | |
contents: write # https://github.com/stefanzweifel/git-auto-commit-action?tab=readme-ov-file#usage | |
runs-on: ubuntu-latest | |
env: | |
VITE_APP_POSTHOG_KEY: ${{ secrets.POSTHOG_PAT_KEY }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
token: ${{ secrets.GH_PAT_REPOS_WORKFLOW }} | |
- name: Setup Node | |
uses: './.github/templates/setup-node' | |
- name: Get songs | |
if: github.event_name == 'workflow_dispatch' | |
run: pnpm ts-node scripts/cicd/githubActionImportSongs.ts "${{ github.event.inputs.user_id }}" "${{ github.event.inputs.days_from }}" "${{ github.event.inputs.days_to }}" | |
- name: Get songs scheduled | |
if: github.event_name == 'schedule' | |
run: pnpm ts-node scripts/cicd/githubActionImportSongs.ts "66cb50c1-fb9f-4c20-b7a7-021fe1c34090,84ff27fb-0095-49a6-be56-e9150f161a50" "" "" | |
- name: Update stats | |
run: pnpm ts-node scripts/generateSongStats.ts | |
- name: Update popularity index | |
run: pnpm ts-node scripts/generateSongPopularityIndex.ts | |
- name: Auto commit songs | |
id: auto-commit-action | |
uses: stefanzweifel/git-auto-commit-action@v5 | |
with: | |
commit_message: 'Update songs from user ${{ github.event.inputs.user_id }}' |