Skip to content

Commit 4a1b2a2

Browse files
authored
feat: .rest.repos.mergeUpstream({ owner, repo, branch }) (#439)
1 parent e458e8c commit 4a1b2a2

File tree

7 files changed

+149
-8
lines changed

7 files changed

+149
-8
lines changed

docs/repos/mergeUpstream.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
---
2+
name: Sync a fork branch with the upstream repository
3+
example: octokit.rest.repos.mergeUpstream({ owner, repo, branch })
4+
route: POST /repos/{owner}/{repo}/merge-upstream
5+
scope: repos
6+
type: API method
7+
---
8+
9+
# Sync a fork branch with the upstream repository
10+
11+
Sync a branch of a forked repository to keep it up-to-date with the upstream repository.
12+
13+
```js
14+
octokit.rest.repos.mergeUpstream({
15+
owner,
16+
repo,
17+
branch,
18+
});
19+
```
20+
21+
## Parameters
22+
23+
<table>
24+
<thead>
25+
<tr>
26+
<th>name</th>
27+
<th>required</th>
28+
<th>description</th>
29+
</tr>
30+
</thead>
31+
<tbody>
32+
<tr><td>owner</td><td>yes</td><td>
33+
34+
</td></tr>
35+
<tr><td>repo</td><td>yes</td><td>
36+
37+
</td></tr>
38+
<tr><td>branch</td><td>yes</td><td>
39+
40+
The name of the branch which should be updated to match upstream.
41+
42+
</td></tr>
43+
</tbody>
44+
</table>
45+
46+
See also: [GitHub Developer Guide documentation](https://docs.github.com/rest/reference/repos#sync-a-fork-branch-with-the-upstream-repository).

package-lock.json

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
"author": "Gregor Martynus (https://twitter.com/gr2m)",
2525
"license": "MIT",
2626
"dependencies": {
27-
"@octokit/types": "^6.26.0",
27+
"@octokit/types": "^6.27.0",
2828
"deprecation": "^2.3.1"
2929
},
3030
"devDependencies": {

scripts/update-endpoints/generated/endpoints.json

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44684,6 +44684,82 @@
4468444684
],
4468544685
"renamed": null
4468644686
},
44687+
{
44688+
"name": "Sync a fork branch with the upstream repository",
44689+
"scope": "repos",
44690+
"id": "mergeUpstream",
44691+
"method": "POST",
44692+
"url": "/repos/{owner}/{repo}/merge-upstream",
44693+
"isDeprecated": false,
44694+
"deprecationDate": null,
44695+
"description": "Sync a branch of a forked repository to keep it up-to-date with the upstream repository.",
44696+
"documentationUrl": "https://docs.github.com/rest/reference/repos#sync-a-fork-branch-with-the-upstream-repository",
44697+
"previews": [],
44698+
"headers": [],
44699+
"parameters": [
44700+
{
44701+
"name": "owner",
44702+
"description": "",
44703+
"in": "PATH",
44704+
"type": "string",
44705+
"required": true,
44706+
"enum": null,
44707+
"allowNull": false,
44708+
"mapToData": null,
44709+
"validation": null,
44710+
"alias": null,
44711+
"deprecated": null
44712+
},
44713+
{
44714+
"name": "repo",
44715+
"description": "",
44716+
"in": "PATH",
44717+
"type": "string",
44718+
"required": true,
44719+
"enum": null,
44720+
"allowNull": false,
44721+
"mapToData": null,
44722+
"validation": null,
44723+
"alias": null,
44724+
"deprecated": null
44725+
},
44726+
{
44727+
"name": "branch",
44728+
"description": "The name of the branch which should be updated to match upstream.",
44729+
"in": "BODY",
44730+
"type": "string",
44731+
"required": true,
44732+
"enum": null,
44733+
"allowNull": false,
44734+
"mapToData": null,
44735+
"validation": null,
44736+
"alias": null,
44737+
"deprecated": null
44738+
}
44739+
],
44740+
"responses": [
44741+
{
44742+
"code": 200,
44743+
"description": "The branch has been successfully synced with the upstream repository",
44744+
"examples": [
44745+
{
44746+
"data": "{\"message\":\"Successfully fetched and fast-forwarded from upstream defunkt:main\",\"merge_type\":\"fast-forward\",\"base_branch\":\"defunkt:main\"}"
44747+
}
44748+
]
44749+
},
44750+
{
44751+
"code": 409,
44752+
"description": "The branch could not be synced because of a merge conflict",
44753+
"examples": null
44754+
},
44755+
{
44756+
"code": 422,
44757+
"description": "The branch could not be synced for some other reason",
44758+
"examples": null
44759+
}
44760+
],
44761+
"renamed": null
44762+
},
4468744763
{
4468844764
"name": "Ping a repository webhook",
4468944765
"scope": "repos",

src/generated/endpoints.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1238,6 +1238,7 @@ const Endpoints: EndpointsDefaultsAndDecorations = {
12381238
],
12391239
listWebhooks: ["GET /repos/{owner}/{repo}/hooks"],
12401240
merge: ["POST /repos/{owner}/{repo}/merges"],
1241+
mergeUpstream: ["POST /repos/{owner}/{repo}/merge-upstream"],
12411242
pingWebhook: ["POST /repos/{owner}/{repo}/hooks/{hook_id}/pings"],
12421243
redeliverWebhookDelivery: [
12431244
"POST /repos/{owner}/{repo}/hooks/{hook_id}/deliveries/{delivery_id}/attempts",

src/generated/method-types.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7800,6 +7800,16 @@ export type RestEndpointMethods = {
78007800
defaults: RequestInterface["defaults"];
78017801
endpoint: EndpointInterface<{ url: string }>;
78027802
};
7803+
/**
7804+
* Sync a branch of a forked repository to keep it up-to-date with the upstream repository.
7805+
*/
7806+
mergeUpstream: {
7807+
(
7808+
params?: RestEndpointMethodTypes["repos"]["mergeUpstream"]["parameters"]
7809+
): Promise<RestEndpointMethodTypes["repos"]["mergeUpstream"]["response"]>;
7810+
defaults: RequestInterface["defaults"];
7811+
endpoint: EndpointInterface<{ url: string }>;
7812+
};
78037813
/**
78047814
* This will trigger a [ping event](https://docs.github.com/webhooks/#ping-event) to be sent to the hook.
78057815
*/

src/generated/parameters-and-response-types.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4570,6 +4570,14 @@ export type RestEndpointMethodTypes = {
45704570
>;
45714571
response: Endpoints["POST /repos/{owner}/{repo}/merges"]["response"];
45724572
};
4573+
mergeUpstream: {
4574+
parameters: RequestParameters &
4575+
Omit<
4576+
Endpoints["POST /repos/{owner}/{repo}/merge-upstream"]["parameters"],
4577+
"baseUrl" | "headers" | "mediaType"
4578+
>;
4579+
response: Endpoints["POST /repos/{owner}/{repo}/merge-upstream"]["response"];
4580+
};
45734581
pingWebhook: {
45744582
parameters: RequestParameters &
45754583
Omit<

0 commit comments

Comments
 (0)