-
Notifications
You must be signed in to change notification settings - Fork 21
48 lines (46 loc) · 1.78 KB
/
import-songs.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
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 }}'