@firestartr/cli 0.1.12 → 0.1.14
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.
|
@@ -51542,6 +51542,7 @@ const team_1 = __importDefault(__nccwpck_require__(43));
|
|
|
51542
51542
|
const user_1 = __importDefault(__nccwpck_require__(2851));
|
|
51543
51543
|
const pull_request_1 = __importDefault(__nccwpck_require__(4670));
|
|
51544
51544
|
const auth_1 = __importDefault(__nccwpck_require__(7745));
|
|
51545
|
+
const issues_1 = __importDefault(__nccwpck_require__(5934));
|
|
51545
51546
|
const auth_2 = __nccwpck_require__(7745);
|
|
51546
51547
|
exports["default"] = {
|
|
51547
51548
|
org: organization_1.default,
|
|
@@ -51553,6 +51554,7 @@ exports["default"] = {
|
|
|
51553
51554
|
getGithubAppToken: auth_2.getGithubAppToken,
|
|
51554
51555
|
auth: auth_1.default,
|
|
51555
51556
|
pulls: pull_request_1.default,
|
|
51557
|
+
issues: issues_1.default
|
|
51556
51558
|
};
|
|
51557
51559
|
|
|
51558
51560
|
|
|
@@ -51620,6 +51622,87 @@ exports["default"] = {
|
|
|
51620
51622
|
};
|
|
51621
51623
|
|
|
51622
51624
|
|
|
51625
|
+
/***/ }),
|
|
51626
|
+
|
|
51627
|
+
/***/ 5934:
|
|
51628
|
+
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
|
51629
|
+
|
|
51630
|
+
"use strict";
|
|
51631
|
+
|
|
51632
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
51633
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
51634
|
+
};
|
|
51635
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
51636
|
+
const auth_1 = __nccwpck_require__(7745);
|
|
51637
|
+
const debug_1 = __importDefault(__nccwpck_require__(7984));
|
|
51638
|
+
const log = (0, debug_1.default)('firestartr:github:issues');
|
|
51639
|
+
async function create(owner, repo, title, body, labels = []) {
|
|
51640
|
+
log(`Creating issue in ${owner}/${repo}`);
|
|
51641
|
+
const octokit = await (0, auth_1.getOctokitForOrg)(owner);
|
|
51642
|
+
return await octokit.rest.issues.create({
|
|
51643
|
+
owner,
|
|
51644
|
+
repo,
|
|
51645
|
+
title,
|
|
51646
|
+
body,
|
|
51647
|
+
labels
|
|
51648
|
+
});
|
|
51649
|
+
}
|
|
51650
|
+
async function update(owner, repo, issue_number, title, body, labels = []) {
|
|
51651
|
+
log(`Updating issue ${issue_number} in ${owner}/${repo}`);
|
|
51652
|
+
const octokit = await (0, auth_1.getOctokitForOrg)(owner);
|
|
51653
|
+
return await octokit.rest.issues.update({
|
|
51654
|
+
owner,
|
|
51655
|
+
repo,
|
|
51656
|
+
issue_number,
|
|
51657
|
+
title,
|
|
51658
|
+
body,
|
|
51659
|
+
labels
|
|
51660
|
+
});
|
|
51661
|
+
}
|
|
51662
|
+
async function filterBy(owner, repo, title, labels, state = 'open', creator = undefined, assignee = undefined) {
|
|
51663
|
+
log(`Filtering issues by title in ${owner}/${repo}`);
|
|
51664
|
+
const octokit = await (0, auth_1.getOctokitForOrg)(owner);
|
|
51665
|
+
const resp = await octokit.rest.issues.listForRepo({
|
|
51666
|
+
owner,
|
|
51667
|
+
repo,
|
|
51668
|
+
state,
|
|
51669
|
+
creator,
|
|
51670
|
+
assignee,
|
|
51671
|
+
labels,
|
|
51672
|
+
per_page: 100,
|
|
51673
|
+
page: 0
|
|
51674
|
+
});
|
|
51675
|
+
return resp.data.filter((issue) => issue.title.includes(title));
|
|
51676
|
+
}
|
|
51677
|
+
async function upsertByTitle(owner, repo, title, body, labels = []) {
|
|
51678
|
+
log(`Upserting issue by title in ${owner}/${repo}`);
|
|
51679
|
+
const foundIssues = (await filterBy(owner, repo, title, labels.join(',')));
|
|
51680
|
+
if (foundIssues.length > 0) {
|
|
51681
|
+
return update(owner, repo, foundIssues[0].number, title, body, labels);
|
|
51682
|
+
}
|
|
51683
|
+
else {
|
|
51684
|
+
return create(owner, repo, title, body, labels);
|
|
51685
|
+
}
|
|
51686
|
+
}
|
|
51687
|
+
async function close(owner, repo, issue_number) {
|
|
51688
|
+
log(`Closing issue ${issue_number} in ${owner}/${repo}`);
|
|
51689
|
+
const octokit = await (0, auth_1.getOctokitForOrg)(owner);
|
|
51690
|
+
return await octokit.rest.issues.update({
|
|
51691
|
+
owner,
|
|
51692
|
+
repo,
|
|
51693
|
+
issue_number,
|
|
51694
|
+
state: 'closed'
|
|
51695
|
+
});
|
|
51696
|
+
}
|
|
51697
|
+
exports["default"] = {
|
|
51698
|
+
create,
|
|
51699
|
+
update,
|
|
51700
|
+
close,
|
|
51701
|
+
filterBy,
|
|
51702
|
+
upsertByTitle
|
|
51703
|
+
};
|
|
51704
|
+
|
|
51705
|
+
|
|
51623
51706
|
/***/ }),
|
|
51624
51707
|
|
|
51625
51708
|
/***/ 978:
|