Skip to content

Commit

Permalink
Build action
Browse files Browse the repository at this point in the history
  • Loading branch information
zegl committed Aug 18, 2022
1 parent c4df425 commit da28760
Show file tree
Hide file tree
Showing 18 changed files with 71,242 additions and 193 deletions.
118 changes: 107 additions & 11 deletions dist/approver/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -33206,7 +33206,7 @@ exports["default"] = get;

/***/ }),

/***/ 2253:
/***/ 878:
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {

"use strict";
Expand Down Expand Up @@ -33669,7 +33669,7 @@ const debug_1 = __importDefault(__nccwpck_require__(8237));
const url_1 = __nccwpck_require__(7310);
// Built-in protocols
const data_1 = __importDefault(__nccwpck_require__(5525));
const file_1 = __importDefault(__nccwpck_require__(2253));
const file_1 = __importDefault(__nccwpck_require__(878));
const ftp_1 = __importDefault(__nccwpck_require__(9886));
const http_1 = __importDefault(__nccwpck_require__(3582));
const https_1 = __importDefault(__nccwpck_require__(5227));
Expand Down Expand Up @@ -63673,14 +63673,19 @@ function run() {
const isPrivate = pr.base.repo.private;
const isFromFork = (_h = pr.head.repo) === null || _h === void 0 ? void 0 : _h.fork;
const isToFork = pr.base.repo.fork;
const feats = yield (0, lib_1.features)({ jobID });
if (!feats.approve) {
core.error('Unable to run this action as the feature is not available for your organization. Please upgrade your Codeball plan, or contact [email protected]');
return;
}
yield octokit.pulls
.createReview({
owner: repoOwner,
repo: repoName,
pull_number: pullRequestNumber,
commit_id: commitId,
body: reviewMessage,
event: 'APPROVE'
event: feats.approve ? 'APPROVE' : 'COMMENT'
})
.catch((error) => __awaiter(this, void 0, void 0, function* () {
if (error instanceof Error &&
Expand Down Expand Up @@ -63843,8 +63848,8 @@ const handleResponse = (response) => __awaiter(void 0, void 0, void 0, function*
throw new Error(yield response.text());
}
});
const get = (path) => __awaiter(void 0, void 0, void 0, function* () {
return (0, node_fetch_1.default)(new URL(path, BASE_URL).toString(), {
const get = (path, params = new URLSearchParams()) => __awaiter(void 0, void 0, void 0, function* () {
return (0, node_fetch_1.default)(new URL(path, BASE_URL).toString() + `?${params.toString()}}`, {
headers: {
'User-Agent': 'github-actions'
},
Expand All @@ -63866,6 +63871,85 @@ const post = (path, body) => __awaiter(void 0, void 0, void 0, function* () {
exports.post = post;


/***/ }),

/***/ 2598:
/***/ ((__unused_webpack_module, exports) => {

"use strict";

Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.eq = void 0;
// eq is an equality check, but treats null and undefined as equal
const eq = (a, b) => {
if (a === null) {
a = undefined;
}
if (b === null) {
b = undefined;
}
return a === b;
};
exports.eq = eq;


/***/ }),

/***/ 8176:
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {

"use strict";

var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
__exportStar(__nccwpck_require__(2598), exports);


/***/ }),

/***/ 9750:
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {

"use strict";

var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.features = void 0;
const api_1 = __nccwpck_require__(9095);
const features = ({ jobID }) => __awaiter(void 0, void 0, void 0, function* () {
if (!jobID) {
return {
approve: true,
label: true
};
}
const j = (0, api_1.get)(`/jobs/${jobID}`).catch(error => console.warn(error));
return j.then(({ features }) => features);
});
exports.features = features;


/***/ }),

/***/ 8216:
Expand Down Expand Up @@ -63908,7 +63992,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
});
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.label = exports.approve = void 0;
exports.suggest = exports.label = exports.approve = void 0;
const api_1 = __nccwpck_require__(9095);
const approve = ({ link, message }) => __awaiter(void 0, void 0, void 0, function* () {
const body = message ? { link, message } : { link };
Expand All @@ -63925,6 +64009,13 @@ const label = (params) => __awaiter(void 0, void 0, void 0, function* () {
return (0, api_1.post)('/github/pulls/label', body);
});
exports.label = label;
const suggest = (params) => __awaiter(void 0, void 0, void 0, function* () {
return (0, api_1.post)('/github/pulls/suggest', Object.entries(params).reduce((acc, [key, value]) => {
acc[key] = value;
return acc;
}, {}));
});
exports.suggest = suggest;


/***/ }),
Expand Down Expand Up @@ -63954,6 +64045,8 @@ __exportStar(__nccwpck_require__(6518), exports);
__exportStar(__nccwpck_require__(3769), exports);
__exportStar(__nccwpck_require__(4154), exports);
__exportStar(__nccwpck_require__(8216), exports);
__exportStar(__nccwpck_require__(9750), exports);
__exportStar(__nccwpck_require__(8176), exports);


/***/ }),
Expand All @@ -63964,12 +64057,14 @@ __exportStar(__nccwpck_require__(8216), exports);
"use strict";

Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.create = exports.get = void 0;
exports.list = exports.create = exports.get = void 0;
const api_1 = __nccwpck_require__(9095);
const get = (id) => (0, api_1.get)(`/jobs/${id}`);
exports.get = get;
const create = ({ url, access_token }) => (0, api_1.post)('/jobs', { url, access_token });
exports.create = create;
const list = (params) => (0, api_1.get)('/jobs', new URLSearchParams(params));
exports.list = list;


/***/ }),
Expand Down Expand Up @@ -63997,7 +64092,6 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
__exportStar(__nccwpck_require__(3006), exports);
__exportStar(__nccwpck_require__(6915), exports);
__exportStar(__nccwpck_require__(4319), exports);
__exportStar(__nccwpck_require__(7616), exports);


/***/ }),
Expand Down Expand Up @@ -64037,12 +64131,12 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
__exportStar(__nccwpck_require__(5465), exports);
__exportStar(__nccwpck_require__(878), exports);
__exportStar(__nccwpck_require__(5107), exports);


/***/ }),

/***/ 878:
/***/ 5107:
/***/ ((__unused_webpack_module, exports) => {

"use strict";
Expand All @@ -64068,11 +64162,13 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
"use strict";

Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.isContributionJob = exports.isFinalStatus = void 0;
exports.isCommentJob = exports.isContributionJob = exports.isFinalStatus = void 0;
const isFinalStatus = (st) => st === 'failure' || st === 'success';
exports.isFinalStatus = isFinalStatus;
const isContributionJob = (job) => job.contribution !== undefined;
exports.isContributionJob = isContributionJob;
const isCommentJob = (job) => job.comment !== undefined;
exports.isCommentJob = isCommentJob;


/***/ }),
Expand Down
2 changes: 1 addition & 1 deletion dist/approver/index.js.map

Large diffs are not rendered by default.

Loading

0 comments on commit da28760

Please sign in to comment.