Skip to content

Commit

Permalink
fix: dont show message if bot force-push
Browse files Browse the repository at this point in the history
renovate force-push on prs and it is the normal flow
  • Loading branch information
christophehurpeau committed Sep 25, 2022
1 parent a9a218a commit e79245f
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/events/pr-handlers/push.ts
@@ -1,6 +1,7 @@
import type { RestEndpointMethodTypes } from '@octokit/rest';
import type { Probot } from 'probot';
import type { AppContext } from '../../context/AppContext';
import { checkIfUserIsBot } from '../../utils/github/isBotUser';
import { createPullRequestsHandler } from './utils/createPullRequestHandler';

export default function status(app: Probot, appContext: AppContext): void {
Expand Down Expand Up @@ -50,6 +51,11 @@ export default function status(app: Probot, appContext: AppContext): void {
const login =
context.payload.pusher.username || context.payload.pusher.name;

const isPushedByBot = checkIfUserIsBot(
repoContext,
context.payload.sender,
);

const isClosedPr = !!pullRequest.closed_at;
let hasReviewStarted: boolean =
!pullRequest.draft &&
Expand All @@ -58,7 +64,7 @@ export default function status(app: Probot, appContext: AppContext): void {
pullRequest.requested_teams?.length
);

if (!isClosedPr && !hasReviewStarted) {
if (!isPushedByBot && !isClosedPr && !hasReviewStarted) {
const reviewsResponse = await context.octokit.pulls.listReviews(
context.repo({
pull_number: pullRequest.number,
Expand All @@ -72,6 +78,7 @@ export default function status(app: Probot, appContext: AppContext): void {
}

if (
!isPushedByBot &&
!isClosedPr &&
hasReviewStarted &&
repoContext.config.warnOnForcePushAfterReviewStarted
Expand Down

0 comments on commit e79245f

Please sign in to comment.