Skip to content

Commit

Permalink
fix: address smells in retrievePayload.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
jreimone committed Oct 12, 2023
1 parent b3b1e7d commit d35f316
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 12 deletions.
8 changes: 8 additions & 0 deletions src/TestIOTriggerTestGHA.ts
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,14 @@ export class TestIOTriggerTestGHA {

const commentContents = `${retrievedComment.data.body}`;
if (!commentContents) Util.prepareErrorMessageAndOptionallyThrow(`Comment ${submitCommentUrl} seems to be empty`, this.errorFile);

const triggerCommentUrl = Util.getUrlFromComment(commentContents);
if (triggerCommentUrl != undefined) {
core.setOutput("testio-create-comment-url", triggerCommentUrl);
} else {
core.setOutput("testio-create-comment-url", "");
}

return commentContents;
}

Expand Down
12 changes: 0 additions & 12 deletions src/retrievePayload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@
*/

import * as github from "@actions/github";
import * as core from "@actions/core";
import {Util} from "./Util";
import * as fs from "fs";
import {TestIOTriggerTestGHA} from "./TestIOTriggerTestGHA";

async function createPayload() {
Expand All @@ -34,15 +31,6 @@ async function createPayload() {
errorFileName
);
const commentContents = await gha.retrieveCommentContent(submitCommentID, submitCommentUrl);

// TODO move this part into gha.retrieveCommentConent
const triggerCommentUrl = Util.getUrlFromComment(commentContents);
if (triggerCommentUrl != undefined) {
core.setOutput("testio-create-comment-url", triggerCommentUrl);
} else {
core.setOutput("testio-create-comment-url", "");
}

const prepareObject = gha.retrieveValidPrepareObjectFromComment(commentContents);
const prTitle: string = await gha.retrievePrTitle();
await gha.createAndPersistTestIoPayload(prepareObject, prTitle);
Expand Down

0 comments on commit d35f316

Please sign in to comment.