Skip to content

Commit

Permalink
s
Browse files Browse the repository at this point in the history
  • Loading branch information
garethahealy committed Jan 5, 2024
1 parent 5863c60 commit 17402f0
Show file tree
Hide file tree
Showing 6 changed files with 63 additions and 17 deletions.
18 changes: 9 additions & 9 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -93,21 +93,21 @@ jobs:
- name: Make github-stats-*-runner executable
run: chmod +x github-stats-*-runner

- name: Run collect-stats for myself
- name: Run collect-stats for UKI
env:
GITHUB_LOGIN: ${{ github.repository_owner }}
GITHUB_OAUTH: ${{ secrets.GITHUB_TOKEN }}
run: ./github-stats-*-runner collect-stats --organization=garethahealy

- name: Run collect-stats for myself
env:
GITHUB_LOGIN: ${{ github.repository_owner }}
GITHUB_OAUTH: ${{ secrets.GITHUB_TOKEN }}
run: echo "todo" #./github-stats-*-runner create-who-are-you-issues --dry-run=true --organization=garethahealy --issue-repo=github-stats --members-csv=tests/members.csv --fail-if-no-vpn=false
GITHUB_OAUTH: ${{ secrets.RHUKI_READ_PAT }}
run: ./github-stats-*-runner collect-stats --organization=RedHat-Consulting-UK

- name: Upload github-output.csv
uses: actions/upload-artifact@c7d193f32edcb7bfad88892161225aeda64e9392 # v4
with:
name: github-output.csv
path: github-output.csv
if-no-files-found: error

- name: Run create-who-are-you-issues for UKI
env:
GITHUB_LOGIN: ${{ github.repository_owner }}
GITHUB_OAUTH: ${{ secrets.GITHUB_TOKEN }}
run: ./github-stats-*-runner create-who-are-you-issues --dry-run=true --organization=RedHat-Consulting-UK --issue-repo=helm3 --members-csv=tests/members.csv --fail-if-no-vpn=false
14 changes: 10 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
<skipITs>true</skipITs>
<surefire-plugin.version>3.2.3</surefire-plugin.version>
</properties>

<dependencyManagement>
<dependencies>
<dependency>
Expand All @@ -28,7 +27,6 @@
</dependency>
</dependencies>
</dependencyManagement>

<dependencies>
<dependency>
<groupId>io.quarkus</groupId>
Expand All @@ -52,11 +50,16 @@
<groupId>org.apache.directory.api</groupId>
<artifactId>api-all</artifactId>
<version>2.1.5</version>
<exclusions>
<exclusion>
<groupId>com.github.ben-manes.caffeine</groupId>
<artifactId>caffeine</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-junit5</artifactId>
<scope>test</scope>
<artifactId>quarkus-caffeine</artifactId>
</dependency>
</dependencies>
<build>
Expand Down Expand Up @@ -127,6 +130,9 @@
<properties>
<skipITs>false</skipITs>
<quarkus.package.type>native</quarkus.package.type>
<quarkus.native.additional-build-args>
-H:+UnlockExperimentalVMOptions,-H:ReflectionConfigurationFiles=reflection-config.json,-H:-UnlockExperimentalVMOptions
</quarkus.native.additional-build-args>
</properties>
</profile>
</profiles>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package com.garethahealy.githubstats;

import io.quarkus.runtime.annotations.RegisterForReflection;
import org.apache.directory.api.ldap.codec.standalone.StandaloneLdapApiService;
import org.apache.mina.transport.socket.nio.NioProcessor;

@RegisterForReflection(targets = {StandaloneLdapApiService.class, NioProcessor.class})
public class ReflectionConfiguration {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package com.garethahealy.githubstats.model;

public class MembersInfo {
public enum Headers {
Timestamp,
EmailAddress,
WhatIsYourGitHubUsername
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.garethahealy.githubstats.rest.client;

import com.garethahealy.githubstats.model.MembersInfo;
import com.garethahealy.githubstats.model.RepoInfo;
import jakarta.enterprise.context.ApplicationScoped;
import jakarta.inject.Inject;
import org.apache.commons.csv.CSVFormat;
Expand Down Expand Up @@ -84,6 +86,7 @@ public void run(String organization, String issueRepo, boolean isDryRun, String
boolean found = false;
for (Entry entry : cursor) {
entry.getDn();
logger.infof("Found %s in ldap", uid);
found = true;
}

Expand All @@ -105,11 +108,15 @@ public void run(String organization, String issueRepo, boolean isDryRun, String

private Set<String> getUsernamesToIgnore(String membersCsv) throws IOException {
Set<String> answer = new HashSet<>();
CSVFormat csvFormat = CSVFormat.Builder.create(CSVFormat.DEFAULT).setSkipHeaderRecord(true).build();
CSVFormat csvFormat = CSVFormat.Builder.create(CSVFormat.DEFAULT)
.setHeader(MembersInfo.Headers.class)
.setSkipHeaderRecord(true)
.build();

try (Reader in = new FileReader(membersCsv)) {
Iterable<CSVRecord> records = csvFormat.parse(in);
for (CSVRecord record : records) {
answer.add(record.get("What is your GitHub username?"));
answer.add(record.get(MembersInfo.Headers.WhatIsYourGitHubUsername));
}
}

Expand All @@ -118,11 +125,15 @@ private Set<String> getUsernamesToIgnore(String membersCsv) throws IOException {

private List<String> getCollectedEmails(String membersCsv) throws IOException {
List<String> answer = new ArrayList<>();
CSVFormat csvFormat = CSVFormat.Builder.create(CSVFormat.DEFAULT).setSkipHeaderRecord(true).build();
CSVFormat csvFormat = CSVFormat.Builder.create(CSVFormat.DEFAULT)
.setHeader(MembersInfo.Headers.class)
.setSkipHeaderRecord(true)
.build();

try (Reader in = new FileReader(membersCsv)) {
Iterable<CSVRecord> records = csvFormat.parse(in);
for (CSVRecord record : records) {
answer.add(record.get("Email Address"));
answer.add(record.get(MembersInfo.Headers.EmailAddress));
}
}

Expand Down
11 changes: 11 additions & 0 deletions src/main/resources/reflection-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[
{
"name" : "com.github.benmanes.caffeine.cache.PSAMS",
"allDeclaredConstructors" : true,
"allPublicConstructors" : true,
"allDeclaredMethods" : true,
"allPublicMethods" : true,
"allDeclaredFields" : true,
"allPublicFields" : true
}
]

0 comments on commit 17402f0

Please sign in to comment.