Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 18 additions & 6 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -212,12 +212,6 @@ async function run(): Promise<void> {
scanForReplacements(messages, baseDependencies, currentDependencies);
}

// Skip comment creation/update if there are no messages
if (messages.length === 0) {
core.info('No dependency warnings found. Skipping comment creation.');
return;
}

const octokit = github.getOctokit(token);
let existingCommentId: number | undefined = undefined;

Expand All @@ -244,6 +238,24 @@ async function run(): Promise<void> {
}
}

// Skip comment creation if there are no messages or update the existing comment.
if (messages.length === 0) {
if (existingCommentId) {
await octokit.rest.issues.updateComment({
owner: github.context.repo.owner,
repo: github.context.repo.repo,
comment_id: existingCommentId,
body: `${COMMENT_TAG}\n## e18e dependency analysis\n\nNo dependency warnings found.\n`
});
core.info(
`Updated existing dependency diff comment #${existingCommentId}`
);
} else {
core.info('No dependency warnings found. Skipping comment creation.');
}
return;
}

const finalCommentBody = `${COMMENT_TAG}\n${messages.join('\n\n')}`;

if (existingCommentId) {
Expand Down
Loading