Pull Requests

Pull Requests describe the changes made to the source code of a project. We will see how to obtain the list of pull requests and their properties.

The pull requests model

The pull requests model contains essential information about the activity of a project, team and developer.

Properties

  • Name
    id
    Type
    string
    Description

    Unique identifier for the pull request.

  • Name
    url
    Type
    string
    Description

    The url for the pull request.

  • Name
    state
    Type
    string
    Description

    The state for the pull request.

  • Name
    title
    Type
    string
    Description

    The title for the pull request.

  • Name
    userId
    Type
    string
    Description

    The author user Id of the pull request.

  • Name
    createdAt
    Type
    timestamp
    Description

    Timestamp of when the pull request was created.

  • Name
    updatedAt
    Type
    timestamp
    Description

    Timestamp of when the pull request was updated.

  • Name
    closedAt
    Type
    timestamp
    Description

    Timestamp of when the pull request was closed.

  • Name
    mergedAt
    Type
    timestamp
    Description

    Timestamp of when the pull request was merged.

  • Name
    additions
    Type
    integer
    Description

    Amount of additions

  • Name
    deletions
    Type
    integer
    Description

    Amount of deletions

  • Name
    changedFiles
    Type
    integer
    Description

    Amount of changed files

  • Name
    reviewsQuantity
    Type
    integer
    Description

    Reviews quantity

  • Name
    repositoryId
    Type
    string
    Description

    The id of the repository.

  • Name
    repositoryName
    Type
    string
    Description

    The name of the repository.

  • Name
    approvalState
    Type
    string
    Description

    Approval state.

  • Name
    approverUser
    Type
    string
    Description

    Approver user.

  • Name
    codingTime
    Type
    double
    Description

    Coding time.

  • Name
    pickupTime
    Type
    double
    Description

    Pickup time.

  • Name
    reviewUntilMerge
    Type
    double
    Description

    Review until merge.

  • Name
    reviewTime
    Type
    double
    Description

    Review time.

  • Name
    closeTime
    Type
    double
    Description

    Close time.

  • Name
    timeUntilDeploy
    Type
    double
    Description

    Time until Deploy.

  • Name
    deployTime
    Type
    double
    Description

    Deploy time.

  • Name
    teams
    Type
    array
    Description

    Team list.

  • Name
    provider
    Type
    string
    Description

    The name of the provider.


GET/api/dashboard/pull-requests

List all pull requests

Request

GET
/api/dashboard/pull-requests
curl -G https://api.pulzen-gateway/api/dashboard/pull-requests \
  -H "Authorization: Basic {token}"

Response

{
    "id": "PR_kwDOJqnh285W8hDM",
    "url": "https://github.com/CleveritDemo/taylor-frontend/pull/248",
    "state": "merged",
    "title": "[DEVELOP ACT@16:00] feat/35182 + bugfix/35973/35978",
    "login": "MatiCleverit",
    "userId": "MatiCleverit",
    "createdAt": "2023-08-01T20:09:57Z",
    "updatedAt": "2023-08-01T20:41:27Z",
    "closedAt": "2023-08-01T20:41:24Z",
    "mergedAt": "2023-08-01T20:41:24Z",
    "commitsQuantity": 3,
    "additions": 189,
    "deletions": -69,
    "changedFiles": 11,
    "reviewsQuantity": 1,
    "repositoryId": "R_kgDOJqnh2w",
    "repositoryName": "taylor-frontend",
    "approvalState": "APPROVED",
    "approverUser": "WilRodAcero",
    "codingTime": 24.73,
    "pickupTime": 62.38,
    "reviewUntilMerge": 0.07,
    "reviewTime": 0.07,
    "closeTime": 0,
    "timeUntilDeploy": 806638.60,
    "deployTime": 0,
    "teams": [
        "Clever-Taylor"
    ],
    "mergedBy": "WilRodAcero",
    "provider": "GITHUB",
    "commitIds": [
        "be61af7077ceca359584ef3ba2a2c3a437bbfd89",
        "4611171a0998f47a1b1509fd235c442c711a5631"
    ]
}

Query Parameters:

  • provider: Can be one of the following: GITHUB, GITLAB, BITBUCKET, AZUREDEVOPS.
  • dateStart: Format YYYY-MM-DD.
  • dateEnd: Format YYYY-MM-DD.

Metrics

  • Coding time from first commit to when a pull request or merge request is created.

From Pull Request: API Endpoint

  • Pickup time from when the pull request is created to when the review begins.

Coding Time

Definition: Time from the first commit to the creation of a pull request or merge request.

  • Review time from the start of the review to when the code is merged.

Attributes to Consider:

  • commit.list must not be null.
  • commit.createdAt is required.
  • pullRequest.createdAt is required.
  • Number of review iterations required to complete a pull request or code review process. Summary:
  • Get all dates before commit.createdAt and choose the earliest one to estimate the duration.
  • The duration is calculated using the earliest date and the pullRequest.createdAt field.
  • The time it takes to complete a code review and get a pull request merged.

Pickup Time

Definition: Time from when the pull request is created to when the review begins.

  • Number of modifications or changes made to the source code.

Attributes to Consider:

  • review.list must not be null.
  • pullRequest.createdAt is required.
  • Amount of newly added source code in a project or in a specific time period.

Summary:

  • Get all dates after review.createdAt and choose the earliest one to estimate the duration.
  • The duration is calculated using the earliest date and the pullRequest.createdAt field.
  • The number of changes or revisions made to the source code of a project.

Review Until Merge Time

Definition: Time from the start of the review to when the code is merged.

  • Number of pull requests opened in a version control repository.

Attributes to Consider:

  • review.list must not be null.
  • pullRequest.createdAt is required.
  • pullRequest.state is required.
  • pullRequest.mergeAt is required.
  • Deploy time from when the code is merged to when it is released.

Summary:

  • The state should be equal to MERGED.
  • Choose the earliest date from the review list, and calculate the duration using the chosen date and the mergeAt date field.
  • Number of active branches in a repository.

Review Time

Definition: Measures the time it takes to complete a code review and get a pull request merged.

  • The size of a pull request's code change in terms of the changes made to the code. Attributes to Consider:
  • review.list must not be null.
  • pullRequest.createdAt is required.
  • pullRequest.state is required.
  • pullRequest.mergeAt is required.
  • The amount of work that involves changes made to existing code that is less than 21 days old. Summary:
  • The state should be equal to MERGED.
  • Choose the latest date from the review list, and calculate the duration using the chosen date and the mergeAt date field.
  • Related to "Rework Rate", but with one key difference: the "age" of the code. It measures the amount of work that involves changes to existing code older than 21 days.

Number Of Reviews Per Pull Request

Definition: Number of review iterations required to complete a pull request or code review process.

  • How often an organization successfully releases to production. Attributes to Consider:
  • review.list must not be null.

Summary:

  • The total elements in the review list are the number of reviews.