-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathaction.yml
More file actions
194 lines (181 loc) · 6.48 KB
/
action.yml
File metadata and controls
194 lines (181 loc) · 6.48 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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
name: 'GitHub Weekly Reporter'
description: 'Generate a beautiful weekly GitHub activity report and deploy to GitHub Pages'
author: 'deariary'
branding:
icon: 'bar-chart-2'
color: 'blue'
inputs:
github-token:
description: 'GitHub token for API access and deployment (requires contents: write permission)'
required: true
username:
description: 'GitHub username to generate the report for'
required: false
default: ${{ github.actor }}
mode:
description: 'Run mode: "daily" (accumulate events) or "weekly" (full report generation)'
required: false
default: 'daily'
language:
description: 'Report language (en, ja, zh-CN, zh-TW, ko, es, fr, de, pt, ru)'
required: false
default: 'en'
timezone:
description: 'IANA timezone for date calculations (e.g. "Asia/Tokyo", "UTC")'
required: false
default: 'UTC'
openai-api-key:
description: 'OpenAI API key for AI narrative'
required: false
default: ''
anthropic-api-key:
description: 'Anthropic API key for AI narrative'
required: false
default: ''
gemini-api-key:
description: 'Gemini API key for AI narrative'
required: false
default: ''
openrouter-api-key:
description: 'OpenRouter API key for AI narrative (access multiple models via unified API)'
required: false
default: ''
groq-api-key:
description: 'Groq API key for AI narrative (fast inference)'
required: false
default: ''
grok-api-key:
description: 'Grok (xAI) API key for AI narrative'
required: false
default: ''
llm-provider:
description: 'LLM provider (openai, anthropic, gemini, openrouter, groq, grok). Required for weekly mode.'
required: false
default: ''
llm-model:
description: 'LLM model name. Required for weekly mode.'
required: false
default: ''
theme:
description: 'Report theme: brutalist, minimal, editorial, swiss'
required: false
default: 'brutalist'
date:
description: 'Target date within the week (YYYY-MM-DD). Defaults to today. Use to generate reports for past weeks.'
required: false
default: ''
version:
description: 'CLI version to use (e.g. "1.2.0", "latest")'
required: false
default: 'latest'
runs:
using: 'composite'
steps:
- name: Setup Node.js
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6
with:
node-version: '24'
- name: Configure git and sync
shell: bash
run: |
git config user.name "github-weekly-reporter[bot]"
git config user.email "github-weekly-reporter[bot]@users.noreply.github.com"
git pull --rebase || true
# --- Daily mode: fetch events and persist ---
- name: Daily fetch (accumulate events)
if: inputs.mode == 'daily'
shell: bash
env:
GITHUB_TOKEN: ${{ inputs.github-token }}
GITHUB_USERNAME: ${{ inputs.username }}
TIMEZONE: ${{ inputs.timezone }}
DATA_DIR: ./data
INPUT_VERSION: ${{ inputs.version }}
INPUT_DATE: ${{ inputs.date }}
run: npx "github-weekly-reporter@${INPUT_VERSION}" daily-fetch ${INPUT_DATE:+--date "$INPUT_DATE"}
- name: Commit and push data (daily)
if: inputs.mode == 'daily'
shell: bash
env:
TIMEZONE: ${{ inputs.timezone }}
INPUT_VERSION: ${{ inputs.version }}
INPUT_DATE: ${{ inputs.date }}
run: |
git add -f data/
if git diff --cached --quiet; then
echo "No new data to commit"
else
MSG=$(npx "github-weekly-reporter@${INPUT_VERSION}" commit-msg daily ${INPUT_DATE:+--date "$INPUT_DATE"})
git commit -m "${MSG}"
git push
fi
# --- Weekly mode: full pipeline ---
- name: Weekly fetch (build full data from accumulated events)
if: inputs.mode == 'weekly'
shell: bash
env:
GITHUB_TOKEN: ${{ inputs.github-token }}
GITHUB_USERNAME: ${{ inputs.username }}
TIMEZONE: ${{ inputs.timezone }}
DATA_DIR: ./data
INPUT_VERSION: ${{ inputs.version }}
INPUT_DATE: ${{ inputs.date }}
run: npx "github-weekly-reporter@${INPUT_VERSION}" weekly-fetch ${INPUT_DATE:+--date "$INPUT_DATE"}
- name: Generate AI content
if: inputs.mode == 'weekly'
shell: bash
env:
OPENAI_API_KEY: ${{ inputs.openai-api-key }}
ANTHROPIC_API_KEY: ${{ inputs.anthropic-api-key }}
GEMINI_API_KEY: ${{ inputs.gemini-api-key }}
OPENROUTER_API_KEY: ${{ inputs.openrouter-api-key }}
GROQ_API_KEY: ${{ inputs.groq-api-key }}
GROK_API_KEY: ${{ inputs.grok-api-key }}
LLM_PROVIDER: ${{ inputs.llm-provider }}
LLM_MODEL: ${{ inputs.llm-model }}
LANGUAGE: ${{ inputs.language }}
TIMEZONE: ${{ inputs.timezone }}
DATA_DIR: ./data
INPUT_VERSION: ${{ inputs.version }}
INPUT_DATE: ${{ inputs.date }}
run: npx "github-weekly-reporter@${INPUT_VERSION}" generate ${INPUT_DATE:+--date "$INPUT_DATE"}
- name: Commit and push data (weekly)
if: inputs.mode == 'weekly'
shell: bash
env:
TIMEZONE: ${{ inputs.timezone }}
INPUT_VERSION: ${{ inputs.version }}
INPUT_DATE: ${{ inputs.date }}
run: |
git add -f data/
if git diff --cached --quiet; then
echo "No new data to commit"
else
MSG=$(npx "github-weekly-reporter@${INPUT_VERSION}" commit-msg weekly ${INPUT_DATE:+--date "$INPUT_DATE"})
git commit -m "${MSG}"
git push
fi
- name: Render HTML report
if: inputs.mode == 'weekly'
shell: bash
env:
LANGUAGE: ${{ inputs.language }}
TIMEZONE: ${{ inputs.timezone }}
THEME: ${{ inputs.theme }}
DATA_DIR: ./data
OUTPUT_DIR: ./output
SITE_TITLE: ${{ env.SITE_TITLE }}
BASE_URL: ${{ env.BASE_URL || format('https://{0}.github.io/{1}', github.repository_owner, github.event.repository.name) }}
INPUT_VERSION: ${{ inputs.version }}
INPUT_DATE: ${{ inputs.date }}
run: npx "github-weekly-reporter@${INPUT_VERSION}" render ${INPUT_DATE:+--date "$INPUT_DATE"}
- name: Deploy to GitHub Pages
if: inputs.mode == 'weekly'
shell: bash
env:
GITHUB_TOKEN: ${{ inputs.github-token }}
GITHUB_REPOSITORY: ${{ github.repository }}
OUTPUT_DIR: ./output
INPUT_VERSION: ${{ inputs.version }}
INPUT_DATE: ${{ inputs.date }}
run: npx "github-weekly-reporter@${INPUT_VERSION}" deploy ${INPUT_DATE:+--date "$INPUT_DATE"}