mobbdev 0.0.72 → 0.0.74
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.mjs +41 -17
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1317,14 +1317,15 @@ async function getGithubBlameRanges({ ref, gitHubUrl, path: path8 }, options) {
|
|
|
1317
1317
|
}
|
|
1318
1318
|
async function createPr({
|
|
1319
1319
|
sourceRepoUrl,
|
|
1320
|
-
|
|
1321
|
-
targetFilePath,
|
|
1320
|
+
filesPaths,
|
|
1322
1321
|
userRepoUrl,
|
|
1323
|
-
title
|
|
1322
|
+
title,
|
|
1323
|
+
body
|
|
1324
1324
|
}, options) {
|
|
1325
1325
|
const oktoKit = getOktoKit(options);
|
|
1326
1326
|
const { owner: sourceOwner, repo: sourceRepo } = parseOwnerAndRepo(sourceRepoUrl);
|
|
1327
1327
|
const { owner, repo } = parseOwnerAndRepo(userRepoUrl);
|
|
1328
|
+
const [sourceFilePath, secondFilePath] = filesPaths;
|
|
1328
1329
|
const sourceFileContentResponse = await oktoKit.rest.repos.getContent({
|
|
1329
1330
|
owner: sourceOwner,
|
|
1330
1331
|
repo: sourceRepo,
|
|
@@ -1345,18 +1346,40 @@ async function createPr({
|
|
|
1345
1346
|
sourceFileContentResponse.data.content,
|
|
1346
1347
|
"base64"
|
|
1347
1348
|
).toString("utf-8");
|
|
1349
|
+
const tree = [
|
|
1350
|
+
{
|
|
1351
|
+
path: sourceFilePath,
|
|
1352
|
+
mode: "100644",
|
|
1353
|
+
type: "blob",
|
|
1354
|
+
content: decodedContent
|
|
1355
|
+
}
|
|
1356
|
+
];
|
|
1357
|
+
if (secondFilePath) {
|
|
1358
|
+
const secondFileContentResponse = await oktoKit.rest.repos.getContent({
|
|
1359
|
+
owner: sourceOwner,
|
|
1360
|
+
repo: sourceRepo,
|
|
1361
|
+
path: "/" + secondFilePath
|
|
1362
|
+
});
|
|
1363
|
+
const secondDecodedContent = Buffer.from(
|
|
1364
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
1365
|
+
// @ts-ignore
|
|
1366
|
+
secondFileContentResponse.data.content,
|
|
1367
|
+
"base64"
|
|
1368
|
+
).toString("utf-8");
|
|
1369
|
+
tree.push({
|
|
1370
|
+
path: secondFilePath,
|
|
1371
|
+
mode: "100644",
|
|
1372
|
+
type: "blob",
|
|
1373
|
+
content: secondDecodedContent
|
|
1374
|
+
});
|
|
1375
|
+
}
|
|
1348
1376
|
const createTreeResponse = await oktoKit.rest.git.createTree({
|
|
1349
1377
|
owner,
|
|
1350
1378
|
repo,
|
|
1351
1379
|
base_tree: await oktoKit.rest.git.getRef({ owner, repo, ref: `heads/${defaultBranch}` }).then((response) => response.data.object.sha),
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
mode: "100644",
|
|
1356
|
-
type: "blob",
|
|
1357
|
-
content: decodedContent
|
|
1358
|
-
}
|
|
1359
|
-
]
|
|
1380
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
1381
|
+
// @ts-ignore
|
|
1382
|
+
tree
|
|
1360
1383
|
});
|
|
1361
1384
|
const createCommitResponse = await oktoKit.rest.git.createCommit({
|
|
1362
1385
|
owner,
|
|
@@ -1377,6 +1400,7 @@ async function createPr({
|
|
|
1377
1400
|
owner,
|
|
1378
1401
|
repo,
|
|
1379
1402
|
title,
|
|
1403
|
+
body,
|
|
1380
1404
|
head: newBranchName,
|
|
1381
1405
|
base: "main"
|
|
1382
1406
|
});
|
|
@@ -1680,7 +1704,7 @@ var GitlabSCMLib = class extends SCMLib {
|
|
|
1680
1704
|
}
|
|
1681
1705
|
throw new Error("not supported yet");
|
|
1682
1706
|
}
|
|
1683
|
-
async createPullRequestWithNewFile(_sourceRepoUrl,
|
|
1707
|
+
async createPullRequestWithNewFile(_sourceRepoUrl, _filesPaths, _userRepoUrl, _title, _body) {
|
|
1684
1708
|
throw new Error("not implemented");
|
|
1685
1709
|
}
|
|
1686
1710
|
async getRepoList() {
|
|
@@ -1867,14 +1891,14 @@ var GithubSCMLib = class extends SCMLib {
|
|
|
1867
1891
|
repo
|
|
1868
1892
|
});
|
|
1869
1893
|
}
|
|
1870
|
-
async createPullRequestWithNewFile(sourceRepoUrl,
|
|
1894
|
+
async createPullRequestWithNewFile(sourceRepoUrl, filesPaths, userRepoUrl, title, body) {
|
|
1871
1895
|
const { pull_request_url } = await createPr(
|
|
1872
1896
|
{
|
|
1873
1897
|
sourceRepoUrl,
|
|
1874
|
-
|
|
1875
|
-
targetFilePath,
|
|
1898
|
+
filesPaths,
|
|
1876
1899
|
userRepoUrl,
|
|
1877
|
-
title
|
|
1900
|
+
title,
|
|
1901
|
+
body
|
|
1878
1902
|
},
|
|
1879
1903
|
{
|
|
1880
1904
|
githubAuthToken: this.accessToken
|
|
@@ -2097,7 +2121,7 @@ var StubSCMLib = class extends SCMLib {
|
|
|
2097
2121
|
console.error("forkRepo() not implemented");
|
|
2098
2122
|
throw new Error("forkRepo() not implemented");
|
|
2099
2123
|
}
|
|
2100
|
-
async createPullRequestWithNewFile(_sourceRepoUrl,
|
|
2124
|
+
async createPullRequestWithNewFile(_sourceRepoUrl, _filesPaths, _userRepoUrl, _title, _body) {
|
|
2101
2125
|
console.error("createPullRequestWithNewFile() not implemented");
|
|
2102
2126
|
throw new Error("createPullRequestWithNewFile() not implemented");
|
|
2103
2127
|
}
|