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
# create: clone 或 pull 仓库并创建数据库
create:
# 不执行 git pull 命令,只执行 git clone,如果项目不存在的话
disablePull: false
#
# (可选项)作者映射关系,因为可能出现同个作者使用了不同的名称或者账号
# authorMappings:
# - source:
# name: "dingdongx"
# email: "chenjiandongx@qq.com"
# destination:
# name: "chenjiandongx"
# email: "chenjiandongx@qq.com"
#
# 数据库信息
databases:
- dir: "./db" # 数据将存放到路径,需自己提前创建好
# 最终扫描的仓库是 files + repos 的 merge 结果
# 如若只想扫描本地的某几个仓库,可以使用直接指定 repos 的方式
# 如若想扫描 Github 账号下的仓库,则推荐使用 `fetch` 命令生成的仓库文件
#
#(可选项)仓库列表文件,由 `fetch` 命令创建,文件内容同 `repos` 属性
# files:
# - "./db/repos.yaml"
#
#(可选项)仓库列表
# repos:
# - name: "chenjiandongx/gitv"
# branch: "master" # 扫描的分支
# path: "~/src/github.com/chenjiandongx/gitv"
# remote: "https://github.com/chenjiandongx/gitv"
# fetch: 拉取 Github 仓库元数据列表
# 目前支持 githubAuthenticated、githubUser、githubOrg,按需填写
fetch:
# https://docs.github.com/en/rest/reference/repos#list-repositories-for-the-authenticated-user
# 拉取 Token 本身账户的仓库列表,可以拉取到 private 仓库
githubAuthenticated:
- cloneDir: "./db" # 项目 clone 路径
destination: "./db/repos.yaml" # repos 列表文件生成路径
token: "${YOUR_GITHUB_TOKEN}" # Github Token
#
#(可选项)排除某些 orgs
# excludeOrgs:
# - "some_orgs"
#
#(可选项)排除某些项目
# excludeRepos:
# - "some_repos"
#
visibility: "owner"
affiliation: "owner,organization_member"
# https://docs.github.com/en/rest/reference/repos#list-repositories-for-a-user
# 拉取某个 Github 用户的仓库列表
githubUser:
- cloneDir: "./db"
destination: "./db/repos-${user}.yaml"
username: "chenjiandongx" # 拉取的用户名
token: "${YOUR_GITHUB_TOKEN}"
#
#(可选项)排除某些项目
# excludeRepos:
# - "some_repos"
#
type: "owner"
# https://docs.github.com/en/rest/reference/repos#list-organization-repositories
# 拉取某个 Github Org 的仓库列表
githubOrg:
- cloneDir: "./db"
destination: "./db/repos-${org}.yaml"
token: "${YOUR_GITHUB_TOKEN}"
#
#(可选项)排除某些项目
# excludeRepos:
# - "some_repos"
#
org: "pyecharts" # 拉取的仓库名
type: ""
# shell: 创建 shell 环境并加载数据
shell:
executions:
- dbName: "db" # 数据库名称
dir: "./db" # 数据文件所在目录
# render: 渲染图表
render:
executions:
- dbName: "db"
dir: "./db"
#(可选项)自定义颜色列表
# colors:
# Blues: ["#deebf7", "#c6dbef", "#9ecae1", "#6baed6", "#4292c6", "#2171b5", "#08519c", "#08306b"]
#
#(可选项)自定义 js 函数,使用 `{{% %}}` 包裹起来
# functions:
# my_function_name: "{{% function (value,context){return Math.round(value*100)/100} %}}"
display:
destination: "./gitstats/static" # 图表生成路径
renderMode: "html" # 渲染格式,有 html/table 可选
#
# (可选项)依赖资源文件,也可以指定为本地依赖
# dependency:
# chartjs: "https://cdn.bootcdn.net/ajax/libs/Chart.js/3.7.1/chart.min.js"
# datalabels: "https://cdn.jsdelivr.net/npm/chartjs-plugin-datalabels@2.0.0"
#
# 执行查询语句和图表生成样式
queries:
- statements: # sql 语句
- "SELECT repo_name, stars from 'db.active' limit 5;"
# chart 为 chartjs 的配置字段,完全遵照 chartjs 的配置格式
# https://www.chartjs.org/docs/latest/
chart:
name: "project-active" # html 文件名称(请使用英文命名)
type: "bar"
width: "680px"
height: "460px"
options:
animation:
duration: 0
plugins:
title:
display: true
text: "title here"
datalabels:
formatter: ${my_function_name}
responsive: false
data:
labels:
- "${repo_name}" # ${field} -> field 会被替换成 sql 中的同名字段数据
datasets:
- data:
- "${stars}" # ${field} -> field 会被替换成 sql 中的同名字段数据
label: "project count"
backgroundColor: "${Blues}" # 替换 colors 中定义的颜色列表