Skip to content

Commit

Permalink
Re-build
Browse files Browse the repository at this point in the history
  • Loading branch information
hmarr committed Mar 15, 2021
1 parent ce1c7f0 commit 72579aa
Showing 1 changed file with 78 additions and 12 deletions.
90 changes: 78 additions & 12 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5828,7 +5828,7 @@ function wrappy (fn, cb) {

/***/ }),

/***/ 399:
/***/ 609:
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {

"use strict";
Expand Down Expand Up @@ -5862,31 +5862,97 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
});
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.approve = void 0;
const core = __importStar(__nccwpck_require__(186));
const github = __importStar(__nccwpck_require__(438));
function run() {
const request_error_1 = __nccwpck_require__(537);
function approve(token, context) {
return __awaiter(this, void 0, void 0, function* () {
const { pull_request: pr } = context.payload;
if (!pr) {
core.setFailed("Event payload missing `pull_request` key. Make sure you're " +
"triggering this action on the `pull_request` or `pull_request_target` events.");
return;
}
const client = github.getOctokit(token);
core.info(`Creating approving review for pull request #${pr.number}`);
try {
const token = core.getInput("github-token", { required: true });
const { pull_request: pr } = github.context.payload;
if (!pr) {
throw new Error("Event payload missing `pull_request`");
}
const client = github.getOctokit(token);
core.debug(`Creating approving review for pull request #${pr.number}`);
yield client.pulls.createReview({
owner: github.context.repo.owner,
repo: github.context.repo.repo,
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: pr.number,
event: "APPROVE",
});
core.debug(`Approved pull request #${pr.number}`);
core.info(`Approved pull request #${pr.number}`);
}
catch (error) {
if (error instanceof request_error_1.RequestError) {
switch (error.status) {
case 401:
core.setFailed(`${error.message}. Please check that the \`github-token\` input ` +
`parameter is set correctly.`);
case 403:
core.setFailed(`${error.message}. In some cases, the GitHub token used for actions triggered ` +
`from \`pull_request\` events are read-only, which can cause this problem. ` +
`Switching to the \`pull_request_target\` event typically resolves this issue.`);
default:
core.setFailed(`Error (code ${error.status}): ${error.message}`);
}
return;
}
core.setFailed(error.message);
return;
}
});
}
exports.approve = approve;


/***/ }),

/***/ 399:
/***/ (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;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
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 }));
const core = __importStar(__nccwpck_require__(186));
const github = __importStar(__nccwpck_require__(438));
const approve_1 = __nccwpck_require__(609);
function run() {
return __awaiter(this, void 0, void 0, function* () {
const token = core.getInput("github-token", { required: true });
yield approve_1.approve(token, github.context);
});
}
run();


Expand Down

0 comments on commit 72579aa

Please sign in to comment.