简体   繁体   English

Stash 中的拉取请求指标

[英]Pull Request Metrics in Stash

We've been asked to generate metrics around how many code reviews we have been doing.我们被要求生成关于我们进行了多少代码审查的指标。 Is there a way in Stash/Git to extract historic pull requests performed on the repo?在 Stash/Git 中有没有办法提取在 repo 上执行的历史拉取请求? In particular, the following would be useful:特别是,以下内容将是有用的:

  • Date/Time of the request请求的日期/时间
  • Requestor Name请求者姓名
  • Approver Name审批人姓名
  • Date/Time of the approval批准日期/时间

As already suggested by Robbie Averill , you can use the Stash REST APIs for this, more specifically the Stash Core REST API , which provides REST resources for core Stash functionality such as server administration, projects, repositories, pull requests and user management :正如Robbie Averill已经建议的那样,您可以为此使用Stash REST API ,更具体地说是Stash Core REST API ,它为核心 Stash 功能(例如服务器管理、项目、存储库、拉取请求和用户管理)提供 REST 资源

GET /rest/api/1.0/projects/{projectKey}/repos/{repositorySlug}/pull-requests yields the paged list of open pull requests against the repo in question. GET /rest/api/1.0/projects/{projectKey}/repos/{repositorySlug}/pull-requests生成针对相关存储库的打开拉取请求的分页列表。 The response contains most of the information you are looking for already, notably the pull request dates, the author , reviewers and even participants :响应包含您已经在寻找的大部分信息,特别是拉取请求日期、 authorreviewers甚至participants

{
    "size": 1,
    "limit": 25,
    "isLastPage": true,
    "values": [
        {
            "id": 101,
            "version": 1,
            "title": "Talking Nerdy",
            "description": "It’s a kludge, but put the tuple from the database in the cache.",
            "state": "OPEN",
            "open": true,
            "closed": false,
            "createdDate": 1359075920,
            "updatedDate": 1359085920,
            "fromRef": {
                "id": "refs/heads/feature-ABC-123",
                "repository": {
                    "slug": "my-repo",
                    "name": null,
                    "project": {
                        "key": "PRJ"
                    }
                }
            },
            "toRef": {
                "id": "refs/heads/master",
                "repository": {
                    "slug": "my-repo",
                    "name": null,
                    "project": {
                        "key": "PRJ"
                    }
                }
            },
            "locked": false,
            "author": {
                "user": {
                    "name": "tom",
                    "emailAddress": "tom@example.com",
                    "id": 115026,
                    "displayName": "Tom",
                    "active": true,
                    "slug": "tom",
                    "type": "NORMAL"
                },
                "role": "AUTHOR",
                "approved": true
            },
            "reviewers": [
                {
                    "user": {
                        "name": "jcitizen",
                        "emailAddress": "jane@example.com",
                        "id": 101,
                        "displayName": "Jane Citizen",
                        "active": true,
                        "slug": "jcitizen",
                        "type": "NORMAL"
                    },
                    "role": "REVIEWER",
                    "approved": true
                }
            ],
            "participants": [
                {
                    "user": {
                        "name": "dick",
                        "emailAddress": "dick@example.com",
                        "id": 3083181,
                        "displayName": "Dick",
                        "active": true,
                        "slug": "dick",
                        "type": "NORMAL"
                    },
                    "role": "PARTICIPANT",
                    "approved": false
                },
                {
                    "user": {
                        "name": "harry",
                        "emailAddress": "harry@example.com",
                        "id": 99049120,
                        "displayName": "Harry",
                        "active": true,
                        "slug": "harry",
                        "type": "NORMAL"
                    },
                    "role": "PARTICIPANT",
                    "approved": true
                }
            ],
            "link": {
                "url": "http://link/to/pullrequest",
                "rel": "self"
            },
            "links": {
                "self": [
                    {
                        "href": "http://link/to/pullrequest"
                    }
                ]
            }
        }
    ],
    "start": 0
}

Approval Dates批准日期

What is missing still is the exact date of approval, though you can approximate it from the pull request closed date if you happen to use Checks for merging pull requests and require at least one approval.仍然缺少的是确切的批准日期,但如果您碰巧使用Checks 合并拉取请求并需要至少一个批准,您可以从拉取请求closed日期近似它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM