project clean up and update

This commit is contained in:
Michael Shick 2022-11-04 16:50:39 -04:00
parent 07f690343c
commit 94fd7ef52f
No known key found for this signature in database
GPG key ID: ADF5BC9704BB4A61
14 changed files with 12140 additions and 6559 deletions

View file

@ -1,7 +1,11 @@
"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]; } });
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];
@ -14,7 +18,7 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
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.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
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;
};
@ -46,10 +50,10 @@ const isMessagePresent = (message, comments, login) => {
const messageClean = message.replace(cleanRe, '');
return comments.some(({ user, body }) => {
// If a username is provided we can save on a bit of processing
if (login && user.login !== login) {
if (login && (user === null || user === void 0 ? void 0 : user.login) !== login) {
return false;
}
return body.replace(cleanRe, '') === messageClean;
return (body === null || body === void 0 ? void 0 : body.replace(cleanRe, '')) === messageClean;
});
};
const getInputs = () => {
@ -74,6 +78,11 @@ const run = async () => {
return;
}
const { full_name: repoFullName } = repository;
if (!repoFullName) {
core.info('repository is missing a full_name property... weird');
core.setOutput('comment-created', 'false');
return;
}
const [owner, repo] = repoFullName.split('/');
let issueNumber;
if (issue && issue.number) {
@ -96,7 +105,7 @@ const run = async () => {
let shouldCreateComment = true;
if (!allowRepeats) {
core.debug('repeat comments are disallowed, checking for existing');
const { data: comments } = await octokit.issues.listComments({
const { data: comments } = await octokit.rest.issues.listComments({
owner,
repo,
issue_number: issueNumber,
@ -118,7 +127,7 @@ const run = async () => {
});
}
else {
await octokit.issues.createComment({
await octokit.rest.issues.createComment({
owner,
repo,
issue_number: issueNumber,
@ -131,8 +140,10 @@ const run = async () => {
core.setOutput('comment-created', 'false');
}
}
catch (error) {
core.setFailed(error.message);
catch (err) {
if (err instanceof Error) {
core.setFailed(err.message);
}
}
};
// Don't auto-execute in the test environment