-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add task that will change the assignee of a github issue.
Refs #7.
- Loading branch information
Showing
7 changed files
with
106 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
gruel/src/main/groovy/com/glasstowerstudios/gruel/tasks/github/ChangeAssigneeTask.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package com.glasstowerstudios.gruel.tasks.github | ||
|
||
import com.glasstowerstudios.gruel.tasks.github.GithubTask | ||
import org.kohsuke.github.GHUser | ||
import org.gradle.api.tasks.TaskAction | ||
|
||
class ChangeAssigneeTask extends GithubTask { | ||
private String assignee; | ||
private int issueNumber; | ||
|
||
int getIssueNumber() { | ||
return issueNumber | ||
} | ||
|
||
void setIssueNumber(int issueNumber) { | ||
this.issueNumber = issueNumber | ||
} | ||
|
||
String getAssignee() { | ||
return this.assignee; | ||
} | ||
|
||
void setAssignee(String assignee) { | ||
this.assignee = assignee; | ||
} | ||
|
||
@TaskAction | ||
def doTask() { | ||
def repo = project.github.connectToRepository() | ||
def issue = repo.getIssue(this.issueNumber) | ||
def collaborators = repo.listCollaborators() | ||
for (GHUser nextUser : collaborators) { | ||
if (nextUser.login == getAssignee()) { | ||
issue.assignTo(nextUser) | ||
return; | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters