From b050128e2f68f1dcb0da039c546b50137e7818cc Mon Sep 17 00:00:00 2001 From: patrick brisbin Date: Wed, 11 Dec 2024 07:50:40 -0500 Subject: [PATCH] Build --- dist/index.js | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/dist/index.js b/dist/index.js index 13e46bd..f60c21f 100644 --- a/dist/index.js +++ b/dist/index.js @@ -405,14 +405,14 @@ async function unhaltOpenPullRequests(client, context, inputs) { await unhaltPullRequest(client, context, inputs, pullRequest); }); } -async function haltPullRequest(client, context, inputs, pullRequest, message) { +async function haltPullRequest(client, context, inputs, pullRequest, msg) { console.info(`Setting halted status for PR #${pullRequest.number}`); await githubApi.createCommitStatus(client, { ...context.repo, sha: pullRequest.head.sha, context: inputs.statusContext, state: "failure", - description: message.title, + description: message.toStatusDescription(msg), target_url: inputs.statusTargetUrl, }); } @@ -487,7 +487,7 @@ run(); "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.toString = exports.fromContent = exports.wasOriginallyEmpty = void 0; +exports.toString = exports.toStatusDescription = exports.fromContent = exports.wasOriginallyEmpty = void 0; const DEFAULT_TITLE = "Merges halted"; function wasOriginallyEmpty(message) { return message.title === DEFAULT_TITLE; @@ -517,6 +517,15 @@ function fromContent(contents) { } } exports.fromContent = fromContent; +function toStatusDescription(message) { + const { title } = message; + const maxLength = 140; + if (title.length > maxLength) { + return `${title.slice(0, maxLength - 3)}...`; + } + return title; +} +exports.toStatusDescription = toStatusDescription; function toString(message) { return message.summary ? `${message.title}\n${message.summary}`