-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
updated CreateWhoAreYouIssue to be abit cleaner
- Loading branch information
1 parent
e4e739f
commit 74ff585
Showing
17 changed files
with
201 additions
and
186 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,5 +39,5 @@ nb-configuration.xml | |
.env | ||
|
||
creds.source | ||
gh-members.csv | ||
supplementary.csv | ||
/gh-members.csv | ||
/supplementary.csv |
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
29 changes: 29 additions & 0 deletions
29
src/main/java/com/garethahealy/githubstats/model/WhoAreYou.java
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,29 @@ | ||
package com.garethahealy.githubstats.model; | ||
|
||
import io.quarkus.runtime.annotations.RegisterForReflection; | ||
import org.apache.commons.lang3.builder.CompareToBuilder; | ||
|
||
@RegisterForReflection | ||
public class WhoAreYou implements Comparable<WhoAreYou> { | ||
|
||
private final String username; | ||
private final String repo; | ||
|
||
public String getUsername() { | ||
return username; | ||
} | ||
|
||
public String getRepo() { | ||
return repo; | ||
} | ||
|
||
public WhoAreYou(String username, String repo) { | ||
this.username = username; | ||
this.repo = repo; | ||
} | ||
|
||
@Override | ||
public int compareTo(WhoAreYou o) { | ||
return new CompareToBuilder().append(this.getUsername(), o.getUsername()).toComparison(); | ||
} | ||
} |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
package com.garethahealy.githubstats.services.users; | ||
|
||
import com.garethahealy.githubstats.model.MembersInfo; | ||
import com.garethahealy.githubstats.model.csv.Members; | ||
import com.garethahealy.githubstats.services.CsvService; | ||
import com.garethahealy.githubstats.services.GitHubService; | ||
import com.garethahealy.githubstats.services.LdapService; | ||
|
@@ -42,20 +42,23 @@ public void run(String organization, String output, String membersCsv, boolean f | |
GHOrganization org = gitHubService.getOrganization(gitHubService.getGitHub(), organization); | ||
List<GHUser> members = gitHubService.listMembers(org); | ||
|
||
Map<String, MembersInfo> knownMembers = csvService.getKnownMembers(membersCsv); | ||
Map<String, Members> knownMembers = csvService.getKnownMembers(membersCsv); | ||
|
||
CSVFormat csvFormat = CSVFormat.Builder.create(CSVFormat.DEFAULT) | ||
.setHeader((MembersInfo.Headers.class)) | ||
.setHeader((Members.Headers.class)) | ||
.build(); | ||
|
||
try (CSVPrinter csvPrinter = new CSVPrinter(Files.newBufferedWriter(Paths.get(output)), csvFormat)) { | ||
// Hard code the bot user to be ignored | ||
csvPrinter.printRecord(new Members("", "[email protected]", "redhat-cop-ci-bot").toArray()); | ||
|
||
if (ldapService.canConnect()) { | ||
try (LdapConnection connection = ldapService.open()) { | ||
for (GHUser user : members) { | ||
if (!knownMembers.containsKey(user.getLogin())) { | ||
String email = ldapService.searchOnGitHub(connection, user.getLogin()); | ||
if (!email.isEmpty()) { | ||
csvPrinter.printRecord(new MembersInfo("", email, user.getLogin()).toArray()); | ||
csvPrinter.printRecord(new Members("", email, user.getLogin()).toArray()); | ||
} | ||
} | ||
} | ||
|
Oops, something went wrong.