Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 62 additions & 0 deletions .github/workflows/update-ky-youtube.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: Crawl Recent TJ Songs

on:
schedule:
- cron: "0 14 * * *" # ํ•œ๊ตญ ์‹œ๊ฐ„ 23:00 ์‹คํ–‰ (UTC+9 โ†’ UTC 14:00)
workflow_dispatch:

permissions:
contents: write # push ๊ถŒํ•œ์„ ์œ„ํ•ด ํ•„์š”

jobs:
run-npm-task:
runs-on: ubuntu-latest

steps:
- name: Checkout branch
uses: actions/checkout@v4
with:
ref: feat/songUpdate
persist-credentials: false # ์ˆ˜๋™ ์ธ์ฆ์œผ๋กœ ํ‘ธ์‹œ ์ œ์–ด

- name: Use Node.js 18
uses: actions/setup-node@v4
with:
node-version: "18"

- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: 9
run_install: false

- name: Install dependencies
working-directory: packages/crawling
run: pnpm install

- name: Create .env file
working-directory: packages/crawling
run: |
echo "SUPABASE_URL=${{ secrets.SUPABASE_URL }}" >> .env
echo "SUPABASE_KEY=${{ secrets.SUPABASE_KEY }}" >> .env

- name: run update script - packages/crawling/crawlYoutube.ts
working-directory: packages/crawling
run: pnpm run ky-youtube

- name: Commit and push changes to feat/songUpdate branch
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"

git checkout feat/songUpdate

git add .
if git diff --cached --quiet; then
echo "โœ… No changes to commit"
else
git commit -m "chore: update crawled TJ song data [skip ci]"
git push origin feat/songUpdate
fi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5 changes: 5 additions & 0 deletions packages/crawling/src/crawling/crawlYoutube.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,11 @@ console.log('getSongsKyNullDB : ', data.length);
let index = 0;

for (const song of data) {
// ํ…Œ์ŠคํŠธ๋ฅผ ์œ„ํ•ด 100ํšŒ ๋ฐ˜๋ณต ํ›„ ์ข…๋ฃŒ์‹œํ‚ค๊ธฐ
if (index >= 100) {
break;
}

const query = song.title + '-' + song.artist;

if (failedSongs.has(query)) {
Expand Down