Skip to content

Commit

Permalink
fix: sending message when pull request merged (#14)
Browse files Browse the repository at this point in the history
  • Loading branch information
nejdetkadir authored Oct 19, 2023
1 parent 3f95512 commit 9265ddf
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
10 changes: 7 additions & 3 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 6 additions & 2 deletions src/lib/bot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,14 @@ async function removeOldPRComments() {
}

async function commentErrors(errors: string[]) {
const { isDraft, PROwner } = await pullRequest.getPRInfo();
const { isDraft, PROwner, isMerged } = await pullRequest.getPRInfo();

if (isMerged) {
return;
}

if (isDraft) {
commentDraftPR();
await commentDraftPR();
return;
}

Expand Down
3 changes: 2 additions & 1 deletion src/lib/pullRequest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ async function getPRInfo() {
isClosed: issue?.data?.state === 'closed',
isAssigned: !!issue?.data?.assignee,
hasReviewers: !!PR?.data?.requested_reviewers?.length,
PROwner: PR?.data?.user?.login ?? ''
PROwner: PR?.data?.user?.login ?? '',
isMerged: PR?.data?.merged_at !== null
};
}

Expand Down

0 comments on commit 9265ddf

Please sign in to comment.