3.4 KiB
3.4 KiB
Pull Requests API reference
Base: https://git.mpm.to/api/v1
Note: In Gitea, pull requests are fetched via the issues endpoint with type=pulls, or via the dedicated /pulls endpoint.
List pull requests for a repository
curl -s -H "Authorization: token e82a7235b948fbbeea60329422fcac89fa5a5ce8" \
"https://git.mpm.to/api/v1/repos/{owner}/{repo}/pulls?state=open&limit=50&page=1"
Query params:
state:open|closed|allsort:oldest|recentupdate|leastupdate|mostcomment|leastcomment|prioritymilestone: milestone IDlabels: comma-separated label IDs
Key response fields: number, title, body, state, user.login, head.label, base.label, mergeable, merged, merged_at, created_at, html_url.
Get a single pull request
curl -s -H "Authorization: token e82a7235b948fbbeea60329422fcac89fa5a5ce8" \
"https://git.mpm.to/api/v1/repos/{owner}/{repo}/pulls/{index}"
Create a pull request
curl -s -X POST \
-H "Authorization: token e82a7235b948fbbeea60329422fcac89fa5a5ce8" \
-H "Content-Type: application/json" \
-d '{
"title": "PR title",
"body": "Description (markdown supported)",
"head": "feature-branch",
"base": "main",
"assignees": ["username"],
"labels": [123],
"milestone": 1
}' \
"https://git.mpm.to/api/v1/repos/{owner}/{repo}/pulls"
head is the branch with changes; base is the branch to merge into.
Update a pull request
curl -s -X PATCH \
-H "Authorization: token e82a7235b948fbbeea60329422fcac89fa5a5ce8" \
-H "Content-Type: application/json" \
-d '{
"title": "Updated title",
"body": "Updated description",
"state": "closed"
}' \
"https://git.mpm.to/api/v1/repos/{owner}/{repo}/pulls/{index}"
Merge a pull request
curl -s -X POST \
-H "Authorization: token e82a7235b948fbbeea60329422fcac89fa5a5ce8" \
-H "Content-Type: application/json" \
-d '{
"Do": "merge",
"merge_message_field": "Merge PR #N: title",
"merge_style": "merge"
}' \
"https://git.mpm.to/api/v1/repos/{owner}/{repo}/pulls/{index}/merge"
merge_style options: merge | rebase | rebase-merge | squash. Always confirm with the user before merging.
Check if a pull request is merged
curl -s -o /dev/null -w "%{http_code}" \
-H "Authorization: token e82a7235b948fbbeea60329422fcac89fa5a5ce8" \
"https://git.mpm.to/api/v1/repos/{owner}/{repo}/pulls/{index}/merge"
Returns 204 if merged, 404 if not merged.
List PR reviews
curl -s -H "Authorization: token e82a7235b948fbbeea60329422fcac89fa5a5ce8" \
"https://git.mpm.to/api/v1/repos/{owner}/{repo}/pulls/{index}/reviews"
Submit a PR review
curl -s -X POST \
-H "Authorization: token e82a7235b948fbbeea60329422fcac89fa5a5ce8" \
-H "Content-Type: application/json" \
-d '{
"body": "Review comment",
"event": "APPROVED"
}' \
"https://git.mpm.to/api/v1/repos/{owner}/{repo}/pulls/{index}/reviews"
event options: APPROVED | REQUEST_CHANGES | COMMENT.
List PR commits
curl -s -H "Authorization: token e82a7235b948fbbeea60329422fcac89fa5a5ce8" \
"https://git.mpm.to/api/v1/repos/{owner}/{repo}/pulls/{index}/commits"
List PR files changed
curl -s -H "Authorization: token e82a7235b948fbbeea60329422fcac89fa5a5ce8" \
"https://git.mpm.to/api/v1/repos/{owner}/{repo}/pulls/{index}/files"