Skip to content

Commit ef0ce21

Browse files
authored
Merge pull request #810 from merico-dev/github-gitlab-README
docs: improve README-zh-CN.md for GitHub and Gitlab
2 parents c6a8b77 + bb2a9c0 commit ef0ce21

File tree

4 files changed

+57
-51
lines changed

4 files changed

+57
-51
lines changed

plugins/github/README-zh-CN.md

Lines changed: 18 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -18,40 +18,36 @@
1818

1919
![image](https://user-images.githubusercontent.com/27032263/141855099-f218f220-1707-45fa-aced-6742ab4c4286.png)
2020

21-
## 获取 Access Token
2221

23-
下面的文档说明了如何获取`Github access token`
24-
25-
https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token
22+
## 配置
2623

27-
## Github 限流
24+
### 数据源连接配置
25+
配置界面需要填入以下字段
26+
- **Connection Name** [`只读`]
27+
- ⚠️ 默认值为 "**Github**" 请不要改动。
28+
- **Endpoint URL** (REST URL, 以 `https://``http://`开头)
29+
- 应当填入可用的REST API Endpoint。例如 `https://api.github.com/`
30+
- ⚠️url应当以`/`结尾
31+
- **Auth Token(s)** (Personal Access Token)
32+
- 如何创建**personal access token**,请参考官方文档[GitHub Docs on Personal Tokens](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token)
33+
- 填入至少一个token,可以填入多个token并以英文逗号`,`间隔,填入多个token可以加快数据采集速度
2834

2935
对于使用`Basic Authentication`或者`OAuth`的请求,限制为5000次/小时/token
30-
3136
- https://docs.github.com/en/rest/overview/resources-in-the-rest-api
32-
3337
通过在配置文件中设置多个token可以达到更高的请求速率
3438

3539
注意: 如果使用付费的企业版`Github`可以达到15000次/小时/token。
40+
关于**GitHub REST API**的更多信息请参考官方文档[GitHub Docs on REST](https://docs.github.com/en/rest)
3641

37-
## 配置
38-
39-
`.evn`文件中需要设置如下配置项
42+
点击**Save Connection**保存配置。
4043

41-
```
4244

43-
GITHUB_AUTH=XXX
45+
### 数据源配置
46+
目前只有一个**可选**配置*Proxy URL*,如果你需要代理才能访问GitHub才需要配置此项
47+
- **GitHub Proxy URL [`可选`]**
48+
- 输入可用的代理服务器地址,例如:`http://your-proxy-server.com:1080`
4449

45-
or...
46-
47-
GITHUB_AUTH=XXX,YYY,ZZZ // 每个token属于不同的用户(可选)
48-
```
49-
50-
如需使用代理需要设置`.env`文件中的`GITHUB_PROXY`配置项。如果此项没有配置或者配置错误,则不会使用代理。目前只支持`http``socks5`两种代理协议。
51-
52-
```
53-
GITHUB_PROXY=http://127.0.0.1:1080
54-
```
50+
点击**Save Settings**保存配置。
5551

5652

5753
## 示例

plugins/github/README.md

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -19,21 +19,6 @@ Here are some examples of what we can use `GitHub` data to show:
1919

2020
![image](https://user-images.githubusercontent.com/27032263/141855099-f218f220-1707-45fa-aced-6742ab4c4286.png)
2121

22-
## Getting Personal Access Token
23-
24-
Here is a link to a guide to get your personal access token from `GitHub`:
25-
26-
https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token
27-
28-
## Github rate limits
29-
30-
"For API requests using `Basic Authentication` or `OAuth`, you can make up to 5,000 requests per hour."
31-
32-
- https://docs.github.com/en/rest/overview/resources-in-the-rest-api
33-
34-
If you have a need for more api rate limits, you can set many tokens in the config file and we will use all of your tokens.
35-
36-
NOTE: You can get 15000 requests/hour/token if you pay for `GitHub` enterprise.
3722

3823
## Configuration
3924

@@ -44,10 +29,18 @@ The connection aspect of the configuration screen requires the following key fie
4429
- ⚠️ Defaults to "**Github**" and may not be changed.
4530
- **Endpoint URL** (REST URL, starts with `https://` or `http://`)
4631
- This should be a valid REST API Endpoint eg. `https://api.github.com/`
32+
- ⚠️ URL should end with`/`
4733
- **Auth Token(s)** (Personal Access Token)
34+
- For help on **Creating a personal access token**, please see official [GitHub Docs on Personal Tokens](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token)
4835
- Provide at least one token for Authentication with the . This field accepts a comma-separated list of values for multiple tokens. The data collection will take longer for GitHub since they have a **rate limit of 2k requests per hour**. You can accelerate the process by configuring _multiple_ personal access tokens.
36+
37+
"For API requests using `Basic Authentication` or `OAuth`, you can make up to 5,000 requests per hour."
4938

50-
For help on **Creating a personal access token**, please see official [GitHub Docs on Personal Tokens](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token)
39+
- https://docs.github.com/en/rest/overview/resources-in-the-rest-api
40+
41+
If you have a need for more api rate limits, you can set many tokens in the config file and we will use all of your tokens.
42+
43+
NOTE: You can get 15000 requests/hour/token if you pay for `GitHub` enterprise.
5144

5245
For an overview of the **GitHub REST API**, please see official [GitHub Docs on REST](https://docs.github.com/en/rest)
5346

plugins/gitlab/README-zh-CN.md

Lines changed: 29 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
# Gitlab 插件
2-
此文档包括 3 部分:指标,配置,如何获取数据。
32

43
## 指标
54
此插件通过收集 Gitlab 的数据来计算以下指标。
@@ -19,26 +18,43 @@
1918

2019
## 配置
2120

22-
插件运行前,你需要在 `.env` 文件中进行以下配置:
21+
### 数据源连接配置
22+
配置界面需要填入以下字段
23+
- **Connection Name** [`只读`]
24+
- ⚠️ 默认值为 "**Gitlab**" 请不要改动。
25+
- **Endpoint URL** (REST URL, 以 `https://``http://`开头)
26+
- 应当填入可用的REST API Endpoint。例如 `https://gitlab.com/api/v4/`
27+
- ⚠️url应当以`/`结尾
28+
- **Personal Access Token** (HTTP Basic Auth)
29+
- 登录你的Gitlab并创建**Personal Access Token**,token长度必须是20个字符。请把生成的token安全保存离开页面后将无法看到。
2330

24-
```
25-
# Gitlab
26-
GITLAB_ENDPOINT=https://gitlab.com/api/v4/
27-
GITLAB_AUTH=<your access token>
28-
```
29-
30-
### 获取自己的 Gitlab Endpoint <a id="gitlab-api-token"></a>
31-
我们使用的 `GITLAB_ENDPOINT``https://gitlab.com/api/v4/`,但不同用户的 Endpoint 会有所区别。关于这个问题的更多信息,请参考 <a href="https://docs.gitlab.com/ee/api/" target="_blank">Gitlab官方API文档</a>
31+
1. 右上角选择**avatar**
32+
2. 选择**Edit profile**
33+
3. 在左侧边栏选择**Access Tokens**
34+
4. 输入**name**并且为此token选择**expiry date**
35+
5. 选择你所需的**scopes**
36+
6. 选择**Create personal access token**
37+
如何创建**personal access token**,请参考官方文档[GitLab Docs on Personal Tokens](https://docs.gitlab.com/ee/user/profile/personal_access_tokens.html)
3238

39+
关于**GitLab REST API**的更多信息请参考官方文档[GitLab Docs on REST](https://docs.gitlab.com/ee/development/documentation/restful_api_styleguide.html#restful-api)
3340

41+
点击**Save Connection**保存配置。
3442

43+
### 数据源配置
44+
当前只有一个**可选**配置,它可以让你将JIRA Boards和GitLab Projects关联起来。
3545

46+
- **JIRA Board Mappings [ `可选`]**
47+
**Map JIRA Boards to GitLab**。请以以下格式输入映射规则
48+
```
49+
# 映射JIRA Board ID 8 ==> Gitlab Projects 8967944,8967945
50+
<JIRA_BOARD>:<GITLAB_PROJECT_ID>,...; 例如 8:8967944,8967945;9:8967946,8967947
51+
```
52+
点击**Save Settings**保存配置。
3653

3754

38-
## 如何触发此插件进行数据收集
55+
## 收集数据
3956

40-
你可以向 `/task` 发起一个POST请求来触发数据收集。由于我们通过 Gitlab project id 来决定收集的数据范畴,因此需要在请求里带上 Gitlab project id<br>
41-
注意:此请求会在收集全部数据时自动触发,你无需单独执行这一请求,也不需要在 `.env` 文件中设置这个。
57+
你可以向 `/task` 发起一个POST请求来触发数据收集。
4258

4359
```
4460
curl --location --request POST 'localhost:8080/task' \

plugins/gitlab/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ The connection aspect of the configuration screen requires the following key fie
2323
- ⚠️ Defaults to "**Gitlab**" and may not be changed.
2424
- **Endpoint URL** (REST URL, starts with `https://` or `http://`)
2525
- This should be a valid REST API Endpoint eg. `https://gitlab.example.com/api/v4/`
26+
- ⚠️ URL should end with`/`
2627
- **Personal Access Token** (HTTP Basic Auth)
2728
- Login to your Gitlab Account and create a **Personal Access Token** to authenticate with the API using HTTP Basic Authentication.. The token must be 20 characters long. Save the personal access token somewhere safe. After you leave the page, you no longer have access to the token.
2829

0 commit comments

Comments
 (0)