-
Notifications
You must be signed in to change notification settings - Fork 0
62 lines (50 loc) · 1.52 KB
/
fetch_top_articles.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
name: Fetch Top Articles
on:
schedule:
# 매주 월요일 오전 0시 UTC에 실행
- cron: "0 0 * * 1"
jobs:
fetch_and_commit:
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v4
- name: Setup Node.js 20.x
uses: actions/setup-node@v4
with:
node-version: 20.x
- uses: pnpm/action-setup@v4
name: Install pnpm
with:
version: 8
- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: pnpm install
# 스크립트 실행
- name: Run fetchTopArticles.js
env:
SERVICE_ACCOUNT_KEY: ${{ secrets.SERVICE_ACCOUNT_KEY }}
run: pnpm weekly
# Git 설정
- name: Configure Git
run: |
git config --global user.email "harimkims@gmail.com"
git config --global user.name "Harim Kim"
# 파일 스테이징 및 커밋
- name: Add and commit changes
run: |
git add data/topArticles.json
git commit -m "feat: Weekly update of top articles"
# 변경 사항 푸시
- name: Push changes
run: git push origin main