Skip to content

Commit

Permalink
Merge pull request #41 from zeoflow/auto-assign-issue
Browse files Browse the repository at this point in the history
Auto assign on new issue
  • Loading branch information
teogor authored Mar 23, 2021
2 parents c39ce08 + 543b712 commit 8a4192e
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions src/apps/auto-assign/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright 2020 ZeoFlow SRL
* Copyright 2021 ZeoFlow SRL
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -32,6 +32,7 @@ class AutoAssign {
'pull_request.opened',
'pull_request.ready_for_review',
'pull_request.reopened',
'issues.opened',
]
}

Expand Down Expand Up @@ -60,6 +61,7 @@ class AutoAssign {
const {
zGithub,
zPullRequest,
zIssue,

zRepoOwner,
zRepoName,
Expand All @@ -70,17 +72,24 @@ class AutoAssign {
return
}

let zContent = zPullRequest
let isPr = true
if(zContent == null)
{
isPr = false
zContent = zIssue
}
const owner = zRepoOwner
const repo = zRepoName
const {
title,
draft,
} = zPullRequest
} = zContent

if (skipKeywords && this.includesSkipKeywords(title, skipKeywords)) {
return
}
if (draft) {
if (draft && isPr) {
return
}
if (useReviewGroups && !reviewGroups) {
Expand All @@ -89,7 +98,7 @@ class AutoAssign {
if (useAssigneeGroups && !assigneeGroups) {
return
}
if (addReviewers) {
if (addReviewers && isPr) {
const {reviewers, team_reviewers} = this.chooseReviewers(owner, zAutoAssign)
if (reviewers.length > 0 || team_reviewers.length > 0) {
await pullsCreateReviewRequest(zGithub, {
Expand Down

0 comments on commit 8a4192e

Please sign in to comment.