mirror of
https://github.com/mshick/add-pr-comment.git
synced 2026-01-01 14:49:44 +11:00
adds support for message-path (#58)
This commit is contained in:
parent
841d232c5a
commit
cd100c8b09
8 changed files with 110 additions and 19 deletions
25
dist/index.js
vendored
25
dist/index.js
vendored
|
|
@ -1107,10 +1107,14 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const core = __importStar(__webpack_require__(470));
|
||||
const github = __importStar(__webpack_require__(469));
|
||||
const http_client_1 = __webpack_require__(425);
|
||||
const promises_1 = __importDefault(__webpack_require__(269));
|
||||
const listCommitPulls = async (params) => {
|
||||
const { repoToken, owner, repo, commitSha } = params;
|
||||
const http = new http_client_1.HttpClient('http-client-add-pr-comment');
|
||||
|
|
@ -1145,6 +1149,7 @@ const getInputs = () => {
|
|||
return {
|
||||
allowRepeats: Boolean(core.getInput('allow-repeats') === 'true'),
|
||||
message: core.getInput('message'),
|
||||
messagePath: core.getInput('message-path'),
|
||||
proxyUrl: core.getInput('proxy-url').replace(/\/$/, ''),
|
||||
repoToken: core.getInput('repo-token') || process.env['GITHUB_TOKEN'],
|
||||
repoTokenUserLogin: core.getInput('repo-token-user-login'),
|
||||
|
|
@ -1152,10 +1157,20 @@ const getInputs = () => {
|
|||
};
|
||||
const run = async () => {
|
||||
try {
|
||||
const { allowRepeats, message, repoToken, repoTokenUserLogin, proxyUrl } = getInputs();
|
||||
const { allowRepeats, message, messagePath, repoToken, repoTokenUserLogin, proxyUrl } = getInputs();
|
||||
if (!repoToken) {
|
||||
throw new Error('no github token provided, set one with the repo-token input or GITHUB_TOKEN env variable');
|
||||
}
|
||||
if (message && messagePath) {
|
||||
throw new Error('must specify only one, message or message-path');
|
||||
}
|
||||
let messageText = message;
|
||||
if (messagePath) {
|
||||
messageText = await promises_1.default.readFile(messagePath, { encoding: 'utf8' });
|
||||
}
|
||||
if (!messageText) {
|
||||
throw new Error('could not get message text, check your message-path');
|
||||
}
|
||||
const { payload: { pull_request: pullRequest, issue, repository }, sha: commitSha, } = github.context;
|
||||
if (!repository) {
|
||||
core.info('unable to determine repository from request type');
|
||||
|
|
@ -1429,6 +1444,14 @@ class Context {
|
|||
exports.Context = Context;
|
||||
//# sourceMappingURL=context.js.map
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 269:
|
||||
/***/ (function(module) {
|
||||
|
||||
module.exports = eval("require")("node:fs/promises");
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 280:
|
||||
|
|
|
|||
2
dist/index.js.map
vendored
2
dist/index.js.map
vendored
File diff suppressed because one or more lines are too long
Loading…
Add table
Add a link
Reference in a new issue