Fix bug where I replaced the comment in the wrong spot
This commit is contained in:
+5
-7
@@ -60,12 +60,6 @@ const MAX_COMMENT_LENGTH = 65536;
|
|||||||
function commentPr(summary, config, minComment) {
|
function commentPr(summary, config, minComment) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
const commentContent = summary.stringify();
|
const commentContent = summary.stringify();
|
||||||
if (commentContent.length >= MAX_COMMENT_LENGTH) {
|
|
||||||
core.setOutput('comment-content', minComment);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
core.setOutput('comment-content', commentContent);
|
|
||||||
}
|
|
||||||
if (!(config.comment_summary_in_pr === 'always' ||
|
if (!(config.comment_summary_in_pr === 'always' ||
|
||||||
(config.comment_summary_in_pr === 'on-failure' &&
|
(config.comment_summary_in_pr === 'on-failure' &&
|
||||||
process.exitCode === core.ExitCode.Failure))) {
|
process.exitCode === core.ExitCode.Failure))) {
|
||||||
@@ -75,7 +69,11 @@ function commentPr(summary, config, minComment) {
|
|||||||
core.warning('Not in the context of a pull request. Skipping comment creation.');
|
core.warning('Not in the context of a pull request. Skipping comment creation.');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const commentBody = `${commentContent}\n\n${COMMENT_MARKER}`;
|
let commentBody = `${commentContent}\n\n${COMMENT_MARKER}`;
|
||||||
|
if (commentBody.length >= MAX_COMMENT_LENGTH) {
|
||||||
|
core.debug('The comment was too big for the GitHub API. Falling back on a minimum comment');
|
||||||
|
commentBody = `${minComment}\n\n${COMMENT_MARKER}`;
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
const existingCommentId = yield findCommentByMarker(COMMENT_MARKER);
|
const existingCommentId = yield findCommentByMarker(COMMENT_MARKER);
|
||||||
if (existingCommentId) {
|
if (existingCommentId) {
|
||||||
|
|||||||
+1
-1
File diff suppressed because one or more lines are too long
+8
-7
@@ -21,12 +21,6 @@ export async function commentPr(
|
|||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
const commentContent = summary.stringify()
|
const commentContent = summary.stringify()
|
||||||
|
|
||||||
if (commentContent.length >= MAX_COMMENT_LENGTH) {
|
|
||||||
core.setOutput('comment-content', minComment)
|
|
||||||
} else {
|
|
||||||
core.setOutput('comment-content', commentContent)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (
|
if (
|
||||||
!(
|
!(
|
||||||
config.comment_summary_in_pr === 'always' ||
|
config.comment_summary_in_pr === 'always' ||
|
||||||
@@ -44,7 +38,14 @@ export async function commentPr(
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
const commentBody = `${commentContent}\n\n${COMMENT_MARKER}`
|
let commentBody = `${commentContent}\n\n${COMMENT_MARKER}`
|
||||||
|
|
||||||
|
if (commentBody.length >= MAX_COMMENT_LENGTH) {
|
||||||
|
core.debug(
|
||||||
|
'The comment was too big for the GitHub API. Falling back on a minimum comment'
|
||||||
|
)
|
||||||
|
commentBody = `${minComment}\n\n${COMMENT_MARKER}`
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const existingCommentId = await findCommentByMarker(COMMENT_MARKER)
|
const existingCommentId = await findCommentByMarker(COMMENT_MARKER)
|
||||||
|
|||||||
Reference in New Issue
Block a user