List Recent Pull Requests

curl --header "Authorization: bearer {your_personal_access_token}" https://api.codeowners.com/api/v1/pulls/{org}/{repository}?limit={limit}

The endpoint will return a list of recent merged pull requests for the given repository. The default limit is 5.

Headers:

Authorization: string; Required;

Append the bearer followed with your personal-access-token

Path parameters:

org : string; Required;

The organization who owns the repository.

repository: string; Required;

The name of the repository.

Response schema:

{
	"type": array,
    "items": {
    	"type": "PullRequest",
        "properties": {
        	"id": {
            	"type": integer,
            },
            "extId": {
            	"type": integer,
                "description": "The external id of the pull request from GitHub."
            },
            "state": {
            	"type": "OPEN" | "CLOSED" | "MERGED",
                "description": "The state of the pull request, whether or not is has been merged into the default branch"
            },
            "head": {
            	"type": string,
                "description": "The head SHA of the pull request"
            },
            "base": {
            	"type": string,
                "description": "The SHA of the base branch; the default branch."
            },
            "title": {
            	"type": string,
                "description": "The title of the pull request"
            },
            "url": {
            	"type": string,
                "description": "A URL which points to the pull request in the SCM."
            },
            "additions": {
            	"type": integer,
                "description": "The number of line additions in the pull request."
            },
            "deletions": {
            	"type": integer,
                "description": "The number of line deletions in the pull request."
			},
            "changedFiles": {
            	"type": integer,
                "description": "The number of changed files in the pull request."
            },
            "createdAt": {
            	"type": timestamp with time zone,
                "description": "The date the pull request was created at."
            },
            "mergedAt": {
            	"type": timestamp with time zone,
                "description": "The date the pull request was merged."
            },
            "mergeCommitSHA": {
            	"type": string,
                "description": "The merge commit SHA."
            }
            "authors": {
            	"type": array,
                "items": {
                	"type": "Contributor",
                    "properties": {
                          "id": {
                              "type": integer,
                              "description": "Id of the user",
                          },
                          "login": {
                              "type": string,
                              "description": "The username of the user on GitHub"
                          },
                          "extId": {
                              "type": integer,
                              "description": "The external id of the user, from GitHub"
                          },
                          "isActive": {
                              "type": boolean,
                              "description": "True if the user still has a valid/active account"
                          },
                          "type": {
                              "type": "User" | "Bot",
                              "description": "The type of the collaborator"
                         },
                         "isActiveCollaborator": {
                         	"type": boolean,
                            "description": "Is true if the collaborator is an active contributor to the given repository."
                         }
                    }
                }
            },
            "reviewers": {
            	"type": array,
                "items": {
                	"type": "Contributor",
                    "properties": {
                          "id": {
                              "type": integer,
                              "description": "Id of the user",
                          },
                          "login": {
                              "type": string,
                              "description": "The username of the user on GitHub"
                          },
                          "extId": {
                              "type": integer,
                              "description": "The external id of the user, from GitHub"
                          },
                          "isActive": {
                              "type": boolean,
                              "description": "True if the user still has a valid/active account"
                          },
                          "type": {
                              "type": "User" | "Bot",
                              "description": "The type of the collaborator"
                         },
                         "isActiveCollaborator": {
                         	"type": boolean,
                            "description": "Is true if the collaborator is an active contributor to the given repository."
                         }
                    }
                }
            }
        }
    }
}

Example response:

[
    {
        "id": 456,
        "extId": 789,
        "state": "MERGED",
        "head": "xyz789",
        "base": "def456",
        "title": "Captain America's shield design",
        "url": "https://github.com/marvel/captainamerica/pulls/456",
        "additions": 75,
        "deletions": 25,
        "changedFiles": 3,
        "createdAt": "2021-06-15T10:30:00Z",
        "mergedAt": "2021-06-20T15:00:00Z",
        "mergeCommitSHA": "123abc",
        "authors": [
            {
                "id": 3,
                "login": "steve",
                "extId": 987,
                "isActive": true,
                "type": "User",
                "isActiveCollaborator": true
            }
        ],
        "reviewers": [
            {
                "id": 4,
                "login": "ironman",
                "extId": 456,
                "isActive": true,
                "type": "User",
                "isActiveCollaborator": true
            },
            {
                "id": 5,
                "login": "thor",
                "extId": 654,
                "isActive": true,
                "type": "User",
                "isActiveCollaborator": true
            }
        ]
    }
]