-
Notifications
You must be signed in to change notification settings - Fork 0
117 lines (99 loc) · 3.79 KB
/
Copy pathdaily-content.yaml
File metadata and controls
117 lines (99 loc) · 3.79 KB
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
name: Daily Content Generation
on:
schedule:
- cron: '30 15 * * 1,3,5' # 월/수/금 00:30 KST (UTC 15:30)
workflow_dispatch:
inputs:
language:
description: '언어 코드'
required: true
default: 'en'
type: choice
options:
- en
- ja
difficulty:
description: '난이도'
required: true
default: '초급'
type: choice
options:
- 초급
- 중급
- 고급
jobs:
generate-content:
runs-on: ubuntu-latest
env:
GEMINI_CLI_TRUST_WORKSPACE: 'true'
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 22.17.1
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 9.0.0
- name: Install dependencies
run: pnpm install
- name: Install gemini-cli
run: |
npm install -g @google/gemini-cli
echo "$(npm root -g)/../bin" >> $GITHUB_PATH
- name: Generate content
id: generate
env:
GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }}
PUBLIC_SUPABASE_URL: ${{ secrets.PUBLIC_SUPABASE_URL }}
PUBLIC_SUPABASE_ANON_KEY: ${{ secrets.PUBLIC_SUPABASE_ANON_KEY }}
run: |
LANGUAGE="${{ github.event.inputs.language || 'en' }}"
DIFFICULTY="${{ github.event.inputs.difficulty || '초급' }}"
echo "언어: $LANGUAGE"
echo "난이도: $DIFFICULTY"
chmod +x .github/scripts/generate-daily-content.sh
./.github/scripts/generate-daily-content.sh "$LANGUAGE" "$DIFFICULTY"
- name: Commit and push changes
env:
LANGUAGE: ${{ github.event.inputs.language || 'en' }}
DIFFICULTY: ${{ github.event.inputs.difficulty || '초급' }}
run: |
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
if [ -n "$(git status --porcelain)" ]; then
NEW_FILE=$(git status --porcelain | grep "content/source/.*\.md" | awk '{print $2}' | head -1)
if [ -n "$NEW_FILE" ]; then
TITLE=$(grep -m 1 "^title:" "$NEW_FILE" | sed 's/title: //' | tr -d '"')
else
TITLE="새 학습 콘텐츠"
fi
if [ -z "$TITLE" ]; then
TITLE="새 학습 콘텐츠"
fi
git add content/source/ content/.content-index.json content/json/
git commit -m "content: ${TITLE} (${LANGUAGE} ${DIFFICULTY})"
if [ -z "$ACT" ]; then
git push
echo "✅ 커밋 및 푸시 완료: content: ${TITLE} (${LANGUAGE} ${DIFFICULTY})"
else
echo "✅ 커밋 완료 (act 환경이므로 push 스킵): content: ${TITLE} (${LANGUAGE} ${DIFFICULTY})"
fi
else
echo "⚠️ 변경사항이 없습니다."
fi
- name: Summary
if: always()
run: |
echo "## 콘텐츠 생성 완료 🎉" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "- **언어**: ${{ github.event.inputs.language || 'en' }}" >> $GITHUB_STEP_SUMMARY
echo "- **난이도**: ${{ github.event.inputs.difficulty || '초급' }}" >> $GITHUB_STEP_SUMMARY
echo "- **생성 시각**: $(date +'%Y-%m-%d %H:%M:%S')" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
REMAINING=$(jq '[.weekly_plan.planned_slugs[] | select(.used == false)] | length' content/.content-index.json)
echo "- **남은 주간 계획**: ${REMAINING}/3" >> $GITHUB_STEP_SUMMARY