Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
bokuweb committed Oct 22, 2023
1 parent 8d9851a commit 01ecc4d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
9 changes: 7 additions & 2 deletions src/comment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export type CreateCommentWithoutTargetInput = {
event: Event;
runId: number;
result: CompareOutput;
artifactName: string;
};

const isSuccess = (result: CompareOutput) => {
Expand Down Expand Up @@ -134,6 +135,8 @@ export const createCommentWithTarget = ({
const baseUrl = createBaseUrl({ owner, repoName, branch: regBranch, runId, artifactName, date });
const successOrFailMessage = isSuccess(result)
? `${badge(result)}
## ${artifactName}
✨✨ That's perfect, there is no visual difference! ✨✨
`
Expand Down Expand Up @@ -163,8 +166,10 @@ ${deletedItems({ result, baseUrl })}
return body;
};

export const createCommentWithoutTarget = ({ result }: CreateCommentWithoutTargetInput): string => {
const body = `Failed to find a target artifact.
export const createCommentWithoutTarget = ({ result, artifactName }: CreateCommentWithoutTargetInput): string => {
const body = `## ${artifactName}
Failed to find a target artifact.
All items will be treated as new items and will be used as expected data for the next time.
![target not found](https://img.shields.io/badge/%E2%9C%94%20reg-new%20items-blue)
Expand Down
2 changes: 1 addition & 1 deletion src/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ export const run = async ({

// If we have current run, add comment to PR.
if (runId) {
const comment = createCommentWithoutTarget({ event, runId, result });
const comment = createCommentWithoutTarget({ event, runId, result, artifactName: config.artifactName });
await client.postComment(event.number, comment);
}
return;
Expand Down

0 comments on commit 01ecc4d

Please sign in to comment.