From 14297486a204e5a760f4c6a96c4a3cd7681158fa Mon Sep 17 00:00:00 2001 From: Erin Schnabel Date: Sat, 15 Jun 2024 18:43:07 -0400 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20events,=20test=20w/=20split=20or?= =?UTF-8?q?ganizations?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../discovery/PostInitialDiscoveryEvent.java | 11 + .../github/discovery/RepositoryDiscovery.java | 16 +- .../discovery/RepositoryDiscoveryEvent.java | 3 +- .../admin/github/TeamMemberSync.java | 212 ++++++++++-------- .../src/main/resources/application.properties | 2 +- .../admin/api/ApplicationEventTest.java | 25 +-- .../automation/admin/api/MemberDataTest.java | 31 +-- .../admin/github/ContextHelper.java | 135 ++++++----- .../admin/github/TeamMemberSyncTest.java | 31 +-- .../github/eventInstallationAdded.json | 38 ++-- .../github/eventInstallationCreated.json | 44 ++-- .../github/eventIssueLabeled-accepted.json | 160 ++++++------- .../github/eventIssueLabeled-declined.json | 158 ++++++------- .../resources/github/mutableUpdateIssue.json | 2 +- .../test/resources/github/queryComments.json | 6 +- .../queryIssue-ApplicationBadTitle.json | 2 +- .../github/queryIssue-ApplicationMatch.json | 2 +- 17 files changed, 472 insertions(+), 406 deletions(-) create mode 100644 bot-github-core/src/main/java/org/commonhaus/automation/github/discovery/PostInitialDiscoveryEvent.java diff --git a/bot-github-core/src/main/java/org/commonhaus/automation/github/discovery/PostInitialDiscoveryEvent.java b/bot-github-core/src/main/java/org/commonhaus/automation/github/discovery/PostInitialDiscoveryEvent.java new file mode 100644 index 0000000..05250e2 --- /dev/null +++ b/bot-github-core/src/main/java/org/commonhaus/automation/github/discovery/PostInitialDiscoveryEvent.java @@ -0,0 +1,11 @@ +package org.commonhaus.automation.github.discovery; + +import org.kohsuke.github.GitHub; + +import io.smallrye.graphql.client.dynamic.api.DynamicGraphQLClient; + +public record PostInitialDiscoveryEvent( + long installationId, + GitHub github, + DynamicGraphQLClient graphQLClient) { +} diff --git a/bot-github-core/src/main/java/org/commonhaus/automation/github/discovery/RepositoryDiscovery.java b/bot-github-core/src/main/java/org/commonhaus/automation/github/discovery/RepositoryDiscovery.java index b60e971..82a3d31 100644 --- a/bot-github-core/src/main/java/org/commonhaus/automation/github/discovery/RepositoryDiscovery.java +++ b/bot-github-core/src/main/java/org/commonhaus/automation/github/discovery/RepositoryDiscovery.java @@ -43,6 +43,9 @@ public class RepositoryDiscovery { @Inject Event repositoryDiscoveryEvent; + @Inject + Event postDiscoveryEvent; + private ContextService ctx; // discoverRepositories is/was being called twice. Avoid double discovery @@ -67,11 +70,14 @@ void discoverRepositories(@Observes StartupEvent ev) { DynamicGraphQLClient graphQLClient = gitHubService.getInstallationGraphQLClient(ghiId); GHAuthenticatedAppInstallation ghai = github.getInstallation(); + Log.debugf("[%s] Fire initial discovery events", ghiId); for (GHRepository repo : ghai.listRepositories()) { repositoryDiscoveryEvent.fire(new RepositoryDiscoveryEvent( DiscoveryAction.ADDED, github, graphQLClient, ghiId, - repo, fetchConfigFile(repo))); + repo, fetchConfigFile(repo), true)); } + Log.debugf("[%s] PostInitialDiscoveryEvent", ghiId); + postDiscoveryEvent.fire(new PostInitialDiscoveryEvent(ghiId, github, graphQLClient)); } } catch (GHIOException e) { ctx.logAndSendEmail("discoverRepositories", "Error making GH Request", e, null); @@ -114,14 +120,14 @@ void onInstallationChange(@RawEvent(event = "installation") GitHubEvent gitHubEv for (GHRepository repo : repositories) { repositoryDiscoveryEvent.fire(new RepositoryDiscoveryEvent( DiscoveryAction.INSTALL_ADDED, github, graphQLClient, installationId, - repo, fetchConfigFile(repo))); + repo, fetchConfigFile(repo), false)); } } case "deleted", "suspend" -> { for (GHRepository repo : repositories) { repositoryDiscoveryEvent.fire(new RepositoryDiscoveryEvent( DiscoveryAction.INSTALL_REMOVED, github, graphQLClient, installationId, - repo, null)); + repo, null, false)); } } default -> { @@ -155,13 +161,13 @@ protected void handleRepositoryChanges(GitHub github, DynamicGraphQLClient graph for (GHRepository repo : added) { repositoryDiscoveryEvent.fire(new RepositoryDiscoveryEvent( DiscoveryAction.ADDED, github, graphQLClient, installationId, - repo, fetchConfigFile(repo))); + repo, fetchConfigFile(repo), false)); } for (GHRepository repo : removed) { repositoryDiscoveryEvent.fire(new RepositoryDiscoveryEvent( DiscoveryAction.REMOVED, github, graphQLClient, installationId, - repo, null)); + repo, null, false)); } } diff --git a/bot-github-core/src/main/java/org/commonhaus/automation/github/discovery/RepositoryDiscoveryEvent.java b/bot-github-core/src/main/java/org/commonhaus/automation/github/discovery/RepositoryDiscoveryEvent.java index ac10b2d..ea9bfab 100644 --- a/bot-github-core/src/main/java/org/commonhaus/automation/github/discovery/RepositoryDiscoveryEvent.java +++ b/bot-github-core/src/main/java/org/commonhaus/automation/github/discovery/RepositoryDiscoveryEvent.java @@ -13,7 +13,8 @@ public record RepositoryDiscoveryEvent( DynamicGraphQLClient graphQLClient, long installationId, GHRepository repository, - Optional repoConfig) { + Optional repoConfig, + boolean bootstrap) { public boolean added() { return action.added(); diff --git a/cf-admin-bot/src/main/java/org/commonhaus/automation/admin/github/TeamMemberSync.java b/cf-admin-bot/src/main/java/org/commonhaus/automation/admin/github/TeamMemberSync.java index d05e97f..1459ce6 100644 --- a/cf-admin-bot/src/main/java/org/commonhaus/automation/admin/github/TeamMemberSync.java +++ b/cf-admin-bot/src/main/java/org/commonhaus/automation/admin/github/TeamMemberSync.java @@ -31,6 +31,7 @@ import org.commonhaus.automation.admin.config.TeamSourceConfig.SyncToTeams; import org.commonhaus.automation.github.context.DataSponsorship; import org.commonhaus.automation.github.context.DataTeam; +import org.commonhaus.automation.github.discovery.PostInitialDiscoveryEvent; import org.commonhaus.automation.github.discovery.RepositoryDiscoveryEvent; import org.commonhaus.automation.markdown.MarkdownConverter; import org.kohsuke.github.GHEventPayload; @@ -106,15 +107,32 @@ public void repositoryDiscovered(@Observes RepositoryDiscoveryEvent repoEvent) { MonitoredRepo cfg = new MonitoredRepo(repoFullName, ghiId).refresh(repoConfig.get()); monitoredRepos.put(cfg, repoFullName); - Log.debugf("repositoryDiscovered: %s", repo.getFullName()); + Log.debugf("[%s] teamSync repositoryDiscovered: %s", repoEvent.installationId(), repo.getFullName()); + if (!repoEvent.bootstrap()) { + // for bootstrap events, wait to queue until after all repositories are discovered + scheduleQueryRepository(cfg, repoEvent.github()); + } + } + + public void postStartupDiscovery(@Observes PostInitialDiscoveryEvent postEvent) { + long ghiId = postEvent.installationId(); + GitHub github = postEvent.github(); + + for (Entry entry : monitoredRepos.entrySet()) { + MonitoredRepo repoCfg = entry.getKey(); - // Scan immediately in dev & test - scheduleQueryRepository(cfg, repo, repoEvent.github()); + if (repoCfg.installationId() == ghiId) { + scheduleQueryRepository(repoCfg, github); + } + } } public void updateTeamMembers(GitHubEvent event, GitHub github, DynamicGraphQLClient graphQLClient, @Push GHEventPayload.Push pushEvent) { GHRepository repo = pushEvent.getRepository(); + ctx.refreshScopedQueryContext(event.getInstallationId(), repo) + .addExisting(github).addExisting(graphQLClient); + Log.debugf("updateTeamMembers (push): %s", repo.getFullName()); for (Entry entry : monitoredRepos.entrySet()) { @@ -128,14 +146,13 @@ public void updateTeamMembers(GitHubEvent event, GitHub github, DynamicGraphQLCl repoCfg.refresh(file); // schedule a query for the repository to refresh the team membership to new config - scheduleQueryRepository(repoCfg, repo, github); + scheduleQueryRepository(repoCfg, github); } } } @Scheduled(cron = "${automation.admin.team-sync-cron:13 27 */5 * * ?}") void scheduledSync() { - String[] errorAddresses = null; try { Iterator> i = monitoredRepos.entrySet().iterator(); while (i.hasNext()) { @@ -145,7 +162,6 @@ void scheduledSync() { GitHub github = ctx.getInstallationClient(repoCfg.installationId()); GHRepository repo = github.getRepository(repoCfg.repoFullName()); - AdminConfigFile file = ctx.getConfiguration(repo); repoCfg.refresh(file); @@ -153,124 +169,136 @@ void scheduledSync() { // Team sync no longer enabled. Remove the repository i.remove(); } else { - scheduleQueryRepository(repoCfg, repo, github); + scheduleQueryRepository(repoCfg, github); } } } catch (GHIOException e) { - ctx.logAndSendEmail("scheduledSync", "Error making GH Request", e, errorAddresses); + ctx.logAndSendEmail("scheduledSync", "Error making GH Request", e, null); if (Log.isDebugEnabled() && e.getResponseHeaderFields() != null) { e.getResponseHeaderFields() .forEach((k, v) -> Log.debugf("%s: %s", k, v)); e.printStackTrace(); } } catch (Throwable t) { - ctx.logAndSendEmail("scheduledSync", "Error making GH Request", t, errorAddresses); + ctx.logAndSendEmail("scheduledSync", "Error making GH Request", t, null); if (Log.isDebugEnabled()) { t.printStackTrace(); } } } - void scheduleQueryRepository(MonitoredRepo repoCfg, GHRepository repo, GitHub github) { - Log.debugf("scheduleQueryRepository: queue repository %s", repo.getFullName()); + void scheduleQueryRepository(MonitoredRepo repoCfg, GitHub github) { + Log.debugf("scheduleQueryRepository: queue repository %s", repoCfg.repoFullName()); + + ScopedQueryContext qc = this.ctx.getScopedQueryContext(repoCfg.repoFullName()); + if (qc == null) { + Log.errorf("[%s] scheduleQueryRepository: no query context for %s", repoCfg.installationId(), + repoCfg.repoFullName()); + return; + } + qc.addExisting(github).addExisting(repoCfg); + for (TeamSourceConfig source : repoCfg.sourceConfig) { if (source.performSync()) { - taskQueue.add(() -> { - ScopedQueryContext qc = this.ctx.refreshScopedQueryContext(repoCfg, repo).addExisting(github); - syncTeamMembership(qc, source); - }); + taskQueue.add(() -> syncTeamMembership(qc, source)); } } - if (repoCfg.sponsors() != null) { - taskQueue.add(() -> { - ScopedQueryContext qc = this.ctx.refreshScopedQueryContext(repoCfg, repo).addExisting(github); - syncSponsors(qc, repoCfg.sponsors()); - }); + taskQueue.add(() -> syncSponsors(qc, repoCfg.sponsors())); } } private void syncSponsors(ScopedQueryContext qc, SponsorsConfig sponsors) { try { - Log.debugf("syncSponsors: %s", sponsors); + Log.debugf("[%s] syncSponsors: %s", qc.getLogId(), sponsors); + Collection sponsorLogins = getSponsors(sponsors.sponsorable()); + addMissingCollaborators(sponsors.repository(), sponsorLogins, sponsors.dryRun(), qc.dryRunEmailAddress()); + } catch (Throwable t) { + qc.logAndSendEmail("syncSponsors", "Error syncing sponsors", t); + } + } - String sponsorable = sponsors.sponsorable(); - ScopedQueryContext sponsorableQc = ctx.getScopedQueryContext(sponsorable); + Collection getSponsors(String sponsorable) { + ScopedQueryContext qc = ctx.getScopedQueryContext(sponsorable); - List recentSponsors = DataSponsorship.queryRecentSponsors(sponsorableQc, sponsors.sponsorable()); - if (recentSponsors == null) { - Log.warnf("[%s] syncSponsors: failed to query sponsors for %s", - sponsorableQc.getLogId(), sponsors.sponsorable()); - return; - } - Collection sponsorLogin = recentSponsors.stream() - .map(DataSponsorship::sponsorLogin) - .collect(Collectors.toCollection(ArrayList::new)); - Log.debugf("syncSponsors: recent sponsors for %s: %s", sponsorable, sponsorLogin); - - String repositoryName = sponsors.repository(); - ScopedQueryContext repoQc = ctx.getScopedQueryContext(repositoryName); - - String orgName = ScopedQueryContext.toOrganizationName(repositoryName); - GHOrganization org = repoQc == null ? null : repoQc.getOrganization(orgName); - if (org == null) { - Log.warnf("syncSponsors: organization %s not found", orgName); - return; - } - GHRepository repo = repoQc == null ? null : repoQc.getRepository(repositoryName); - if (repo == null) { - Log.warnf("syncSponsors: repository %s not found", repositoryName); - return; - } + List recentSponsors = DataSponsorship.queryRecentSponsors(qc, sponsorable); + if (recentSponsors == null) { + Log.warnf("[%s] syncSponsors: failed to query sponsors for %s", + qc.getLogId(), sponsorable); + return List.of(); + } + Collection sponsorLogin = recentSponsors.stream() + .map(DataSponsorship::sponsorLogin) + .collect(Collectors.toCollection(ArrayList::new)); - List missingCollaborators = new ArrayList<>(); - Set existingCollaborators = repoQc.collaborators(repositoryName); - for (String login : sponsorLogin) { - if (existingCollaborators.contains(login)) { - continue; - } - GHUser ghUser = repoQc.getUser(login); - if (ghUser == null) { - Log.warnf("syncSponsors: user %s not found", login); - continue; - } - missingCollaborators.add(ghUser); + Log.debugf("[%s] syncSponsors: recent sponsors for %s: %s", qc.getLogId(), + sponsorable, sponsorLogin); + return sponsorLogin; + } + + void addMissingCollaborators(String repositoryName, Collection sponsorLogins, boolean isDryRun, + String[] dryRunEmail) throws Throwable { + ScopedQueryContext qc = ctx.getScopedQueryContext(repositoryName); + if (qc == null) { + throw new IllegalStateException("No query context for " + repositoryName); + } + String orgName = ScopedQueryContext.toOrganizationName(repositoryName); + GHOrganization org = qc.getOrganization(orgName); + if (org == null) { + Log.warnf("[%s] syncSponsors: organization %s not found", qc.getLogId(), orgName); + return; + } + GHRepository repo = qc.getRepository(repositoryName); + if (repo == null) { + Log.warnf("[%s] syncSponsors: repository %s not found", qc.getLogId(), repositoryName); + return; + } + + Set collaborators = qc.collaborators(repositoryName); + + List missingCollaborators = new ArrayList<>(); + for (String login : sponsorLogins) { + if (collaborators.contains(login)) { + continue; + } + GHUser ghUser = qc.getUser(login); + if (ghUser == null) { + Log.warnf("syncSponsors: user %s not found", login); + continue; } + missingCollaborators.add(ghUser); + } - if (sponsors.dryRun()) { - List added = missingCollaborators.stream().map(GHUser::getLogin).collect(Collectors.toList()); - List finalList = new ArrayList<>(existingCollaborators); - finalList.addAll(added); - Logins allLogins = new Logins( - existingCollaborators, - added, - List.of(), - finalList); - sendDryRunEmail(repositoryName + " collaborators:", allLogins, qc.dryRunEmailAddress()); - } else { - repoQc.addCollaborators(repo, missingCollaborators); - if (repoQc.clearNotFound() && repoQc.hasErrors()) { - throw repoQc.bundleExceptions(); - } + if (isDryRun) { + List added = missingCollaborators.stream().map(GHUser::getLogin).collect(Collectors.toList()); + List finalList = new ArrayList<>(collaborators); + finalList.addAll(added); + Logins allLogins = new Logins( + collaborators, + added, + List.of(), + finalList); + sendDryRunEmail(repositoryName + " collaborators:", allLogins, dryRunEmail); + } else { + qc.addCollaborators(repo, missingCollaborators); + if (qc.clearNotFound() && qc.hasErrors()) { + throw qc.bundleExceptions(); } - } catch (Throwable t) { - qc.logAndSendEmail("syncSponsors", "Error syncing sponsors", t); } } void syncTeamMembership(ScopedQueryContext qc, TeamSourceConfig source) { - Log.debugf("syncTeamMembership: %s / %s", source.repo(), source.path()); + Log.debugf("[%s] syncTeamMembership: %s / %s", qc.getLogId(), source.repo(), source.path()); GHRepository repo = qc.getRepository(source.repo()); if (repo == null) { - Log.warnf("syncTeamMembership: source repository %s not found", source.repo()); + Log.warnf("[%s] syncTeamMembership: source repository %s not found", qc.getLogId(), source.repo()); return; } // get contents of file from the specified repo + path JsonNode data = qc.readSourceFile(repo, source.path()); if (data == null) { - Log.warnf("syncTeamMembership: source file %s not found or could not be read", source.path()); return; } @@ -283,20 +311,19 @@ void syncTeamMembership(ScopedQueryContext qc, TeamSourceConfig source) { JsonNode sourceTeamData = data.get(groupName); if (sourceTeamData != null && sourceTeamData.isArray()) { - Log.debugf("syncTeamMembership: field %s from %s to %s", field, groupName, sync.teams()); + Log.debugf("[%s] syncTeamMembership: field %s from %s to %s", qc.getLogId(), field, groupName, sync.teams()); - Set logins = new HashSet<>(); - logins.addAll(sync.preserveUsers(defaults)); + Set logins = new HashSet<>(sync.preserveUsers(defaults)); for (JsonNode member : sourceTeamData) { JsonNode node = member.get(field); String login = node == null || !node.isTextual() ? null : node.asText(); if (login == null || !login.matches("^[a-zA-Z0-9-]+$")) { - Log.debugf("syncTeamMembership: ignoring empty %s in %s", member, groupName); + Log.debugf("[%s] syncTeamMembership: ignoring empty %s in %s", qc.getLogId(), member, groupName); } else { logins.add(login); } } - Log.debugf("syncTeamMembership: source group %s has members %s", groupName, logins); + Log.debugf("[%s] syncTeamMembership: source group %s has members %s", qc.getLogId(), groupName, logins); for (String targetTeam : sync.teams()) { try { @@ -309,7 +336,7 @@ void syncTeamMembership(ScopedQueryContext qc, TeamSourceConfig source) { } } } else { - Log.debugf("syncTeamMembership: group %s not found in %s", groupName, data); + Log.debugf("[%s] syncTeamMembership: group %s not found in %s", qc.getLogId(), groupName, data); } } } @@ -323,13 +350,14 @@ void doSyncTeamMembers(TeamSourceConfig config, String fullTeamName, Set ScopedQueryContext qc = ctx.getScopedQueryContext(orgName); GHOrganization org = qc == null ? null : qc.getOrganization(orgName); if (org == null) { - Log.warnf("doSyncTeamMembers: %s %s not found", qc == null ? "ScopedQueryContext for " : "Organization", orgName); + Log.warnf("doSyncTeamMembers: %s %s not found", + qc == null ? "ScopedQueryContext for " : "Organization", orgName); return; } GHTeam team = qc.getTeam(org, relativeName); if (team == null) { - Log.warnf("doSyncTeamMembers: team %s not found in %s", relativeName, orgName); + Log.warnf("[%s] doSyncTeamMembers: team %s not found in %s", qc.getLogId(), relativeName, orgName); return; } @@ -357,18 +385,18 @@ void doSyncTeamMembers(TeamSourceConfig config, String fullTeamName, Set try { GHUser user = gh.getUser(login); team.add(user); - Log.infof("doSyncTeamMembers: add %s to %s", user, fullTeamName); + Log.infof("[%s] doSyncTeamMembers: add %s to %s", qc.getLogId(), user, fullTeamName); } catch (IOException e) { - Log.warnf("doSyncTeamMembers: failed to add %s to %s", login, fullTeamName); + Log.warnf("[%s] doSyncTeamMembers: failed to add %s to %s", qc.getLogId(), login, fullTeamName); } } for (String login : toRemove) { try { GHUser user = gh.getUser(login); team.remove(user); - Log.infof("doSyncTeamMembers: remove %s from %s", user, fullTeamName); + Log.infof("[%s] doSyncTeamMembers: remove %s from %s", qc.getLogId(), user, fullTeamName); } catch (IOException e) { - Log.warnf("doSyncTeamMembers: failed to remove %s from %s", login, fullTeamName); + Log.warnf("[%s] doSyncTeamMembers: failed to remove %s from %s", qc.getLogId(), login, fullTeamName); } } return null; diff --git a/cf-admin-bot/src/main/resources/application.properties b/cf-admin-bot/src/main/resources/application.properties index 2143c80..2f47eb2 100644 --- a/cf-admin-bot/src/main/resources/application.properties +++ b/cf-admin-bot/src/main/resources/application.properties @@ -21,7 +21,7 @@ automation.reply-to=no-reply@example.com %prod.automation.error-email-address=automation@commonhaus.dev %prod.automation.reply-to=no-reply@commonhaus.org -automation.admin.data-store=commonhaus-test/ops-test +automation.admin.data-store=datastore/org automation.admin.member-home=http://localhost:3000/member/ %dev.quarkus.scheduler.enabled=false diff --git a/cf-admin-bot/src/test/java/org/commonhaus/automation/admin/api/ApplicationEventTest.java b/cf-admin-bot/src/test/java/org/commonhaus/automation/admin/api/ApplicationEventTest.java index a5ad6c2..bad8a0d 100644 --- a/cf-admin-bot/src/test/java/org/commonhaus/automation/admin/api/ApplicationEventTest.java +++ b/cf-admin-bot/src/test/java/org/commonhaus/automation/admin/api/ApplicationEventTest.java @@ -20,7 +20,6 @@ import org.commonhaus.automation.admin.AdminDataCache; import org.commonhaus.automation.admin.api.CommonhausUser.MemberStatus; -import org.commonhaus.automation.admin.config.AdminConfigFile; import org.commonhaus.automation.admin.github.AppContextService; import org.commonhaus.automation.admin.github.ContextHelper; import org.junit.jupiter.api.BeforeEach; @@ -76,7 +75,7 @@ void testApplicationApproved() throws Exception { GitHubAppTesting.given() .github(mocks -> { - mocks.configFile(AdminConfigFile.NAME).fromClasspath("/cf-admin.yml"); + setupInstallationRepositories(mocks, ctx); GitHub botGithub = setupBotGithub(ctx, mocks); when(botGithub.isCredentialValid()).thenReturn(true); @@ -86,10 +85,10 @@ void testApplicationApproved() throws Exception { mockUpdateCommonhausData(builder, botGithub, ctx); - when(mocks.installationGraphQLClient(installationId) + when(mocks.installationGraphQLClient(datastoreInstallationId) .executeSync(contains("removeLabelsFromLabelable("), anyMap())) .thenReturn(removeLabel); - when(mocks.installationGraphQLClient(installationId) + when(mocks.installationGraphQLClient(datastoreInstallationId) .executeSync(contains("RemoveReaction("), anyMap())) .thenReturn(removeReaction); }) @@ -115,12 +114,12 @@ void testApplicationApproved() throws Exception { verify(mocks.issue(2345115049L)).close(); // 5) remove application/new - verify(mocks.installationGraphQLClient(installationId), timeout(500)) + verify(mocks.installationGraphQLClient(datastoreInstallationId), timeout(500)) .executeSync(contains("removeLabelsFromLabelable("), anyMap()); - verify(mocks.installationGraphQLClient(installationId), timeout(500)) + verify(mocks.installationGraphQLClient(datastoreInstallationId), timeout(500)) .executeSync(contains("RemoveReaction("), anyMap()); - verifyNoMoreInteractions(mocks.installationGraphQLClient(installationId)); + verifyNoMoreInteractions(mocks.installationGraphQLClient(datastoreInstallationId)); }); await().atMost(5, SECONDS).until(() -> mailbox.getTotalMessagesSent() == 1); @@ -144,7 +143,7 @@ void testApplicationDenied() throws Exception { GitHubAppTesting.given() .github(mocks -> { - mocks.configFile(AdminConfigFile.NAME).fromClasspath("/cf-admin.yml"); + setupInstallationRepositories(mocks, ctx); GitHub botGithub = setupBotGithub(ctx, mocks); when(botGithub.isCredentialValid()).thenReturn(true); @@ -154,10 +153,10 @@ void testApplicationDenied() throws Exception { mockUpdateCommonhausData(builder, botGithub, ctx); - when(mocks.installationGraphQLClient(installationId) + when(mocks.installationGraphQLClient(datastoreInstallationId) .executeSync(contains("removeLabelsFromLabelable("), anyMap())) .thenReturn(removeLabel); - when(mocks.installationGraphQLClient(installationId) + when(mocks.installationGraphQLClient(datastoreInstallationId) .executeSync(contains("RemoveReaction("), anyMap())) .thenReturn(removeReaction); }) @@ -181,12 +180,12 @@ void testApplicationDenied() throws Exception { verify(mocks.issue(2345115049L)).close(); // 5) remove application/new - verify(mocks.installationGraphQLClient(installationId), timeout(500)) + verify(mocks.installationGraphQLClient(datastoreInstallationId), timeout(500)) .executeSync(contains("removeLabelsFromLabelable("), anyMap()); - verify(mocks.installationGraphQLClient(installationId), timeout(500)) + verify(mocks.installationGraphQLClient(datastoreInstallationId), timeout(500)) .executeSync(contains("RemoveReaction("), anyMap()); - verifyNoMoreInteractions(mocks.installationGraphQLClient(installationId)); + verifyNoMoreInteractions(mocks.installationGraphQLClient(datastoreInstallationId)); }); await().atMost(5, SECONDS).until(() -> mailbox.getTotalMessagesSent() == 1); diff --git a/cf-admin-bot/src/test/java/org/commonhaus/automation/admin/api/MemberDataTest.java b/cf-admin-bot/src/test/java/org/commonhaus/automation/admin/api/MemberDataTest.java index c161e8a..9dca5dc 100644 --- a/cf-admin-bot/src/test/java/org/commonhaus/automation/admin/api/MemberDataTest.java +++ b/cf-admin-bot/src/test/java/org/commonhaus/automation/admin/api/MemberDataTest.java @@ -77,6 +77,7 @@ void init() throws IOException { Stream.of(AdminDataCache.values()).forEach(AdminDataCache::invalidateAll); mockContext = GitHubAppTestingContext.get(); + setupInstallationRepositories(mockContext.mocks, ctx); botGithub = setupBotGithub(ctx, mockContext.mocks); when(botGithub.isCredentialValid()).thenReturn(true); @@ -179,7 +180,7 @@ void testLoginEndpoint() throws Exception { }) void testGetCommonhausUserNotFound() throws Exception { GHUser botUser = botGithub.getUser(botLogin); - appendMockTeam(organizationName + "/team-quorum-default", botUser); + appendMockTeam(sponsorsOrgName + "/team-quorum-default", botUser); GHRepository dataStore = botGithub.getRepository(ctx.getDataStore()); when(dataStore.getFileContent(anyString())).thenThrow(new GHFileNotFoundException("Badness")); @@ -208,7 +209,7 @@ void testGetCommonhausUserNotFound() throws Exception { }) void testGetCommonhausUserBadnessHappens() throws Exception { GHUser botUser = botGithub.getUser(botLogin); - appendMockTeam(organizationName + "/team-quorum-default", botUser); + appendMockTeam(sponsorsOrgName + "/team-quorum-default", botUser); GHRepository dataStore = botGithub.getRepository(ctx.getDataStore()); when(dataStore.getFileContent(anyString())).thenThrow(new IOException("Badness")); @@ -239,7 +240,7 @@ void testGetCommonhausUser() throws Exception { mockExistingCommonhausData(botGithub, ctx); GHUser botUser = botGithub.getUser(botLogin); - appendMockTeam(organizationName + "/team-quorum-default", botUser); + appendMockTeam(sponsorsOrgName + "/team-quorum-default", botUser); given() .log().all() @@ -277,7 +278,7 @@ void testPutAttestation() throws Exception { GHContentBuilder builder = mockUpdateCommonhausData(botGithub, ctx); GHUser botUser = botGithub.getUser(botLogin); - appendMockTeam(organizationName + "/cf-voting", botUser); + appendMockTeam(sponsorsOrgName + "/cf-voting", botUser); given() .log().all() @@ -324,7 +325,7 @@ void testPutAttestation() throws Exception { }) void testPutUnknownAttestation() throws Exception { GHUser botUser = botGithub.getUser(botLogin); - appendMockTeam(organizationName + "/team-quorum-default", botUser); + appendMockTeam(sponsorsOrgName + "/team-quorum-default", botUser); AttestationPost attestation = new AttestationPost( "unknown", @@ -366,7 +367,7 @@ void testPutAttestations() throws Exception { GHContentBuilder builder = mockUpdateCommonhausData(botGithub, ctx); GHUser botUser = botGithub.getUser(botLogin); - appendMockTeam(organizationName + "/team-quorum-default", botUser); + appendMockTeam(sponsorsOrgName + "/team-quorum-default", botUser); given() .log().all() @@ -415,7 +416,7 @@ void testPutAttestations() throws Exception { }) void testGetUnknownApplication() throws Exception { GHUser botUser = botGithub.getUser(botLogin); - appendMockTeam(organizationName + "/team-quorum-default", botUser); + appendMockTeam(sponsorsOrgName + "/team-quorum-default", botUser); mockExistingCommonhausData(botGithub, ctx); @@ -451,7 +452,7 @@ void testGetInvalidApplication() throws Exception { GHUser botUser = botGithub.getUser(botLogin); when(botGithub.getMyself()).thenReturn(myself); - appendMockTeam(organizationName + "/team-quorum-default", botUser); + appendMockTeam(sponsorsOrgName + "/team-quorum-default", botUser); mockExistingCommonhausData(botGithub, ctx, "src/test/resources/haus-member-application.yaml"); @@ -459,7 +460,7 @@ void testGetInvalidApplication() throws Exception { GHContentBuilder builder = mockUpdateCommonhausData(botGithub, ctx); Response queryIssue = mockResponse("src/test/resources/github/queryIssue-ApplicationBadTitle.json"); - when(mockContext.mocks.installationGraphQLClient(installationId) + when(mockContext.mocks.installationGraphQLClient(sponsorsInstallationId) .executeSync(contains("query($id: ID!) {"), anyMap())) .thenReturn(queryIssue); @@ -501,17 +502,17 @@ void testGetApplicationWithFeedback() throws Exception { GHUser botUser = botGithub.getUser(botLogin); when(botGithub.getMyself()).thenReturn(myself); - appendMockTeam(organizationName + "/team-quorum-default", botUser); + appendMockTeam(sponsorsOrgName + "/team-quorum-default", botUser); mockExistingCommonhausData(botGithub, ctx, "src/test/resources/haus-member-application.yaml"); Response queryIssue = mockResponse("src/test/resources/github/queryIssue-ApplicationMatch.json"); - when(mockContext.mocks.installationGraphQLClient(installationId) + when(mockContext.mocks.installationGraphQLClient(datastoreInstallationId) .executeSync(contains("query($id: ID!) {"), anyMap())) .thenReturn(queryIssue); Response queryComments = mockResponse("src/test/resources/github/queryComments.json"); - when(mockContext.mocks.installationGraphQLClient(installationId) + when(mockContext.mocks.installationGraphQLClient(datastoreInstallationId) .executeSync(contains("comments(first: 50"), anyMap())) .thenReturn(queryComments); @@ -558,17 +559,17 @@ void testSubmitApplication() throws Exception { GHUser botUser = botGithub.getUser(botLogin); when(botGithub.getMyself()).thenReturn(myself); - appendMockTeam(organizationName + "/team-quorum-default", botUser); + appendMockTeam(sponsorsOrgName + "/team-quorum-default", botUser); mockExistingCommonhausData(botGithub, ctx, "src/test/resources/haus-member-application.yaml"); Response queryIssue = mockResponse("src/test/resources/github/queryIssue-ApplicationMatch.json"); - when(mockContext.mocks.installationGraphQLClient(installationId) + when(mockContext.mocks.installationGraphQLClient(datastoreInstallationId) .executeSync(contains("query($id: ID!) {"), anyMap())) .thenReturn(queryIssue); Response updateIssue = mockResponse("src/test/resources/github/mutableUpdateIssue.json"); - when(mockContext.mocks.installationGraphQLClient(installationId) + when(mockContext.mocks.installationGraphQLClient(datastoreInstallationId) .executeSync(contains("updateIssue(input: {"), anyMap())) .thenReturn(updateIssue); diff --git a/cf-admin-bot/src/test/java/org/commonhaus/automation/admin/github/ContextHelper.java b/cf-admin-bot/src/test/java/org/commonhaus/automation/admin/github/ContextHelper.java index 2f903bb..715cfc5 100644 --- a/cf-admin-bot/src/test/java/org/commonhaus/automation/admin/github/ContextHelper.java +++ b/cf-admin-bot/src/test/java/org/commonhaus/automation/admin/github/ContextHelper.java @@ -50,17 +50,22 @@ public class ContextHelper extends QueryContext { - public static final long installationId = 50263360; - public static final long organizationId = 144493209; - public static final String organizationName = "commonhaus-test"; + public static final long sponsorsInstallationId = 50263360; + public static final long sponsorsOrgId = 144493209; + public static final String sponsorsOrgName = "commonhaus-test"; + public static final String sponsorsRepo = "commonhaus-test/sponsors-test"; + public static final String sponsorsRepoId = "R_sponsors"; + + public static final long datastoreInstallationId = 50264360; + public static final long datastoreOrganizationId = 801851090; + public static final String datastoreOrgName = "datastore"; + public static final String datastoreRepoName = "datastore/org"; + public static final String datastoreRepoId = "R_datastore"; public static final long botId = 156364140; public static final String botLogin = "commonhaus-bot"; public static final String botNodeId = "U_kgDOCVHtbA"; - public static final String datastoreRepoId = "R_kgDOL8tG0g"; - public static final String commonhausTestRepoId = "R_-2034603297"; - public static final DataLabel APP_NEW = new DataLabel.Builder() .name(ApplicationData.NEW).build(); public static final DataLabel APP_ACCEPTED = new DataLabel.Builder() @@ -81,7 +86,59 @@ public void customize(ObjectMapper mapper) { } protected ContextHelper() { - super(mock(AppContextService.class), installationId); + super(mock(AppContextService.class), sponsorsInstallationId); + } + + public void setupInstallationRepositories(GitHubMockSetupContext mocks, AppContextService ctx) throws IOException { + setLabels(datastoreRepoId, APP_LABELS); + + GitHub s_gh = mocks.installationClient(sponsorsInstallationId); + ctx.updateConnection(sponsorsInstallationId, s_gh); + DynamicGraphQLClient s_dql = mocks.installationGraphQLClient(sponsorsInstallationId); + ctx.updateConnection(sponsorsInstallationId, s_dql); + + setupMockRepository(mocks, s_gh, ctx, "commonhaus/foundation"); + setupMockOrganization(mocks, sponsorsInstallationId, sponsorsOrgName, sponsorsOrgId); + + GHRepository repo = setupMockRepository(mocks, s_gh, ctx, sponsorsRepo, sponsorsRepoId); + RepositoryDiscoveryEvent repoEvent = new RepositoryDiscoveryEvent( + DiscoveryAction.ADDED, + mocks.installationClient(sponsorsInstallationId), + mocks.installationGraphQLClient(sponsorsInstallationId), + sponsorsInstallationId, + repo, + Optional.ofNullable(null), + false); + + ctx.repositoryDiscovered(repoEvent); + ctx.writeToInstallId.put(sponsorsOrgName, sponsorsInstallationId); + ctx.writeToInstallId.put(sponsorsRepo, sponsorsInstallationId); + ctx.readToInstallId.put("commonhaus", sponsorsInstallationId); + + GitHub ds_gh = mocks.installationClient(datastoreInstallationId); + ctx.updateConnection(datastoreInstallationId, ds_gh); + DynamicGraphQLClient ds_dql = mocks.installationGraphQLClient(datastoreInstallationId); + ctx.updateConnection(datastoreInstallationId, ds_dql); + + repo = setupMockRepository(mocks, ds_gh, ctx, datastoreRepoName, datastoreRepoId); + setupMockOrganization(mocks, datastoreInstallationId, datastoreOrgName, datastoreOrganizationId); + + repoEvent = new RepositoryDiscoveryEvent( + DiscoveryAction.ADDED, + mocks.installationClient(datastoreInstallationId), + mocks.installationGraphQLClient(datastoreInstallationId), + datastoreInstallationId, + repo, + Optional.ofNullable(null), + false); + ctx.repositoryDiscovered(repoEvent); + ctx.writeToInstallId.put(datastoreOrgName, datastoreInstallationId); + ctx.writeToInstallId.put(datastoreRepoName, datastoreInstallationId); + + mocks.configFile(AdminConfigFile.NAME).fromClasspath("/cf-admin.yml"); + AdminConfigFile config = AppContextService.yamlMapper().readValue( + getClass().getResourceAsStream("/cf-admin.yml"), AdminConfigFile.class); + ctx.userConfig = config.userManagement(); } public static GHUser mockGHUser(String login) { @@ -99,13 +156,8 @@ public static GHUser mockGHUser(String login) { } public GitHub setupMockTeam(GitHubMockSetupContext mocks) throws IOException { - GHOrganization org = Mockito.mock(GHOrganization.class); - when(org.getLogin()).thenReturn(organizationName); - when(org.getId()).thenReturn(organizationId); - - GitHub gh = mocks.installationClient(installationId); - when(gh.getOrganization(organizationName)).thenReturn(org); - when(gh.isCredentialValid()).thenReturn(true); + GitHub gh = mocks.installationClient(sponsorsInstallationId); + GHOrganization org = gh.getOrganization(sponsorsOrgName); Set testQuorum = new HashSet<>(); Set council = new HashSet<>(); @@ -139,6 +191,17 @@ protected GHRepository setupMockRepository(GitHubMockSetupContext mocks, GitHub return setupMockRepository(mocks, gh, ctx, repoName, "R_" + repoName.hashCode()); } + protected GHOrganization setupMockOrganization(GitHubMockSetupContext mocks, long installationId, String orgName, + long orgId) throws IOException { + GHOrganization org = mocks.ghObject(GHOrganization.class, orgId); + when(org.getLogin()).thenReturn(orgName); + when(org.getId()).thenReturn(orgId); + + GitHub gh = mocks.installationClient(installationId); + when(gh.getOrganization(orgName)).thenReturn(org); + return org; + } + protected GHRepository setupMockRepository(GitHubMockSetupContext mocks, GitHub gh, AppContextService ctx, String repoName, String nodeId) @@ -148,35 +211,10 @@ protected GHRepository setupMockRepository(GitHubMockSetupContext mocks, GitHub when(repo.getNodeId()).thenReturn(nodeId); when(gh.getRepository(repoName)).thenReturn(repo); - ctx.refreshScopedQueryContext(installationId, repo); + ctx.refreshScopedQueryContext(sponsorsInstallationId, repo); return repo; } - void setupRepositoryAccess(GitHubMockSetupContext mocks, AppContextService ctx, GitHub gh) throws IOException { - GHRepository repo = setupMockRepository(mocks, gh, ctx, ctx.getDataStore()); - RepositoryDiscoveryEvent repoEvent = new RepositoryDiscoveryEvent( - DiscoveryAction.ADDED, - mocks.installationClient(installationId), - mocks.installationGraphQLClient(installationId), - installationId, - repo, - Optional.ofNullable(null)); - ctx.repositoryDiscovered(repoEvent); - - repo = setupMockRepository(mocks, gh, ctx, "commonhaus-test/sponsors-test"); - repoEvent = new RepositoryDiscoveryEvent( - DiscoveryAction.ADDED, - mocks.installationClient(installationId), - mocks.installationGraphQLClient(installationId), - installationId, - repo, - Optional.ofNullable(null)); - ctx.repositoryDiscovered(repoEvent); - - ctx.writeToInstallId.put("commonhaus-test", installationId); - ctx.readToInstallId.put("commonhaus", installationId); - } - protected GHTeam setupMockTeam(GitHubMockSetupContext mocks, String name, GHOrganization org, Set userSet) throws IOException { setupMockTeam("commonhaus-test/" + name, userSet); @@ -207,26 +245,15 @@ public void addCollaborator(String repoName, String login) { } public GitHub setupBotGithub(AppContextService ctx, GitHubMockSetupContext mocks) throws IOException { - GitHub gh = mocks.installationClient(installationId); - ctx.updateConnection(installationId, gh); - DynamicGraphQLClient dql = mocks.installationGraphQLClient(installationId); - ctx.updateConnection(installationId, dql); + GitHub gh = mocks.installationClient(datastoreInstallationId); GHUser bot = mockGHUser(botLogin); when(gh.getUser(botLogin)).thenReturn(bot); ctx.updateUserConnection(botNodeId, gh); - setupRepositoryAccess(mocks, ctx, gh); - setLabels(datastoreRepoId, APP_LABELS); - setLabels(commonhausTestRepoId, APP_LABELS); - ctx.attestationIds.add("member"); ctx.attestationIds.add("coc"); - AdminConfigFile config = AppContextService.yamlMapper().readValue( - getClass().getResourceAsStream("/cf-admin.yml"), AdminConfigFile.class); - ctx.userConfig = config.userManagement(); - return gh; } @@ -252,7 +279,7 @@ public void mockExistingCommonhausData(GitHub botGithub, AppContextService ctx, when(content.read()).thenReturn(Files.newInputStream(Path.of(filename))); when(content.getSha()).thenReturn("1234567890abcdef"); - GHRepository dataStore = botGithub.getRepository(ctx.getDataStore()); + GHRepository dataStore = botGithub.getRepository(datastoreRepoName); when(dataStore.getFileContent(anyString())).thenReturn(content); } @@ -278,7 +305,7 @@ public GHContentBuilder mockUpdateCommonhausData(GHContentBuilder builder, GitHu .thenReturn(Files.newInputStream(Path.of(filename))); when(responseContent.getSha()).thenReturn("1234567890adefgh"); - GHRepository dataStore = botGithub.getRepository(ctx.getDataStore()); + GHRepository dataStore = botGithub.getRepository(datastoreRepoName); when(dataStore.createContent()).thenReturn(builder); GHContentUpdateResponse response = Mockito.mock(GHContentUpdateResponse.class); diff --git a/cf-admin-bot/src/test/java/org/commonhaus/automation/admin/github/TeamMemberSyncTest.java b/cf-admin-bot/src/test/java/org/commonhaus/automation/admin/github/TeamMemberSyncTest.java index f401613..309caac 100644 --- a/cf-admin-bot/src/test/java/org/commonhaus/automation/admin/github/TeamMemberSyncTest.java +++ b/cf-admin-bot/src/test/java/org/commonhaus/automation/admin/github/TeamMemberSyncTest.java @@ -21,7 +21,6 @@ import jakarta.inject.Inject; -import org.commonhaus.automation.admin.config.AdminConfigFile; import org.commonhaus.automation.github.context.BaseQueryCache; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -120,7 +119,11 @@ void testDiscoveryWhenInstallationCreated() throws Exception { void testQueryFailed() throws Exception { given() .github(mocks -> { - GHRepository foundationRepo = setupRepoConfigMocks(mocks); + setupInstallationRepositories(mocks, ctx); + addGraphQLTeamMemberResults(mocks); + + GitHub gh = mocks.installationClient(sponsorsInstallationId); + GHRepository foundationRepo = gh.getRepository("commonhaus/foundation"); when(foundationRepo.getFileContent("CONTACTS.yaml")) .thenThrow(new IOException("Test exception")); @@ -138,24 +141,14 @@ void testQueryFailed() throws Exception { assertThat(mailbox.getMailsSentTo("dry-run@example.com")).hasSize(1); } - GHRepository setupRepoConfigMocks(GitHubMockSetupContext mocks) throws IOException { - mocks.configFile(AdminConfigFile.NAME).fromClasspath("/cf-admin.yml"); - - GitHub gh = setupMockTeam(mocks); - setupMockRepository(mocks, gh, ctx, "commonhaus-test/sponsors-test"); - setupMockRepository(mocks, gh, ctx, ctx.getDataStore()); - GHRepository foundationRepo = setupMockRepository(mocks, gh, ctx, "commonhaus/foundation"); - - setupRepositoryAccess(mocks, ctx, gh); - return foundationRepo; - } - void setupFoundationContacts(GitHubMockSetupContext mocks) throws IOException { - GHRepository foundationRepo = setupRepoConfigMocks(mocks); + setupInstallationRepositories(mocks, ctx); + GitHub gh = setupMockTeam(mocks); GHContent content = mock(GHContent.class); when(content.read()).thenReturn(Files.newInputStream(Path.of("src/test/resources/CONTACTS.yaml"))); + GHRepository foundationRepo = gh.getRepository("commonhaus/foundation"); when(foundationRepo.getFileContent("CONTACTS.yaml")).thenReturn(content); } @@ -165,19 +158,19 @@ void addGraphQLTeamMemberResults(GitHubMockSetupContext mocks) throws ExecutionE Response queryQuorum = mockResponse("src/test/resources/github/query-TeamLogins-teamQuorum.json"); Response querySponsorships = mockResponse("src/test/resources/github/querySponsorshipsAsMaintainer.json"); - when(mocks.installationGraphQLClient(installationId) + when(mocks.installationGraphQLClient(sponsorsInstallationId) .executeSync(anyString(), argThat((Map map) -> map != null && map.containsValue("cf-council")))) .thenReturn(queryCouncil); - when(mocks.installationGraphQLClient(installationId) + when(mocks.installationGraphQLClient(sponsorsInstallationId) .executeSync(anyString(), argThat((Map map) -> map != null && map.containsValue("cf-voting")))) .thenReturn(queryVoting); - when(mocks.installationGraphQLClient(installationId) + when(mocks.installationGraphQLClient(sponsorsInstallationId) .executeSync(anyString(), argThat((Map map) -> map != null && map.containsValue("team-quorum-default")))) .thenReturn(queryQuorum); - when(mocks.installationGraphQLClient(installationId) + when(mocks.installationGraphQLClient(sponsorsInstallationId) .executeSync(contains("sponsorshipsAsMaintainer("), anyMap())) .thenReturn(querySponsorships); } diff --git a/cf-admin-bot/src/test/resources/github/eventInstallationAdded.json b/cf-admin-bot/src/test/resources/github/eventInstallationAdded.json index 526ac3b..47e5b01 100644 --- a/cf-admin-bot/src/test/resources/github/eventInstallationAdded.json +++ b/cf-admin-bot/src/test/resources/github/eventInstallationAdded.json @@ -1,31 +1,31 @@ { "action": "added", "installation": { - "id": 50263360, + "id": 50264360, "account": { - "login": "commonhaus-test", - "id": 168673220, - "node_id": "O_kgDOCg2_xA", + "login": "datastore", + "id": 801851090, + "node_id": "O_datastore", "avatar_url": "https://avatars.githubusercontent.com/u/168673220?v=4", "gravatar_id": "", - "url": "https://api.github.com/users/commonhaus-test", - "html_url": "https://github.com/commonhaus-test", - "followers_url": "https://api.github.com/users/commonhaus-test/followers", - "following_url": "https://api.github.com/users/commonhaus-test/following{/other_user}", - "gists_url": "https://api.github.com/users/commonhaus-test/gists{/gist_id}", - "starred_url": "https://api.github.com/users/commonhaus-test/starred{/owner}{/repo}", - "subscriptions_url": "https://api.github.com/users/commonhaus-test/subscriptions", - "organizations_url": "https://api.github.com/users/commonhaus-test/orgs", - "repos_url": "https://api.github.com/users/commonhaus-test/repos", - "events_url": "https://api.github.com/users/commonhaus-test/events{/privacy}", - "received_events_url": "https://api.github.com/users/commonhaus-test/received_events", + "url": "https://api.github.com/users/datastore", + "html_url": "https://github.com/datastore", + "followers_url": "https://api.github.com/users/datastore/followers", + "following_url": "https://api.github.com/users/datastore/following{/other_user}", + "gists_url": "https://api.github.com/users/datastore/gists{/gist_id}", + "starred_url": "https://api.github.com/users/datastore/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/datastore/subscriptions", + "organizations_url": "https://api.github.com/users/datastore/orgs", + "repos_url": "https://api.github.com/users/datastore/repos", + "events_url": "https://api.github.com/users/datastore/events{/privacy}", + "received_events_url": "https://api.github.com/users/datastore/received_events", "type": "Organization", "site_admin": false }, "repository_selection": "all", "access_tokens_url": "https://api.github.com/app/installations/50263360/access_tokens", "repositories_url": "https://api.github.com/installation/repositories", - "html_url": "https://github.com/organizations/commonhaus-test/settings/installations/50263360", + "html_url": "https://github.com/organizations/datastore/settings/installations/50263360", "app_id": 794963, "app_slug": "commonhaus-test-bot", "target_id": 168673220, @@ -74,9 +74,9 @@ "repositories_added": [ { "id": 801851090, - "node_id": "R_kgDOL8tG0g", - "name": "ops-test", - "full_name": "commonhaus-test/ops-test", + "node_id": "R_datastore", + "name": "org", + "full_name": "datastore/org", "private": true } ], diff --git a/cf-admin-bot/src/test/resources/github/eventInstallationCreated.json b/cf-admin-bot/src/test/resources/github/eventInstallationCreated.json index f60c559..70b26a2 100644 --- a/cf-admin-bot/src/test/resources/github/eventInstallationCreated.json +++ b/cf-admin-bot/src/test/resources/github/eventInstallationCreated.json @@ -1,34 +1,34 @@ { "action": "created", "installation": { - "id": 50263360, + "id": 50264360, "account": { - "login": "commonhaus-ops", - "id": 168359006, - "node_id": "O_kgDOCgj0Xg", - "avatar_url": "https://avatars.githubusercontent.com/u/168359006?v=4", + "login": "datastore", + "id": 801851090, + "node_id": "O_datastore", + "avatar_url": "https://avatars.githubusercontent.com/u/168673220?v=4", "gravatar_id": "", - "url": "https://api.github.com/users/commonhaus-ops", - "html_url": "https://github.com/commonhaus-ops", - "followers_url": "https://api.github.com/users/commonhaus-ops/followers", - "following_url": "https://api.github.com/users/commonhaus-ops/following{/other_user}", - "gists_url": "https://api.github.com/users/commonhaus-ops/gists{/gist_id}", - "starred_url": "https://api.github.com/users/commonhaus-ops/starred{/owner}{/repo}", - "subscriptions_url": "https://api.github.com/users/commonhaus-ops/subscriptions", - "organizations_url": "https://api.github.com/users/commonhaus-ops/orgs", - "repos_url": "https://api.github.com/users/commonhaus-ops/repos", - "events_url": "https://api.github.com/users/commonhaus-ops/events{/privacy}", - "received_events_url": "https://api.github.com/users/commonhaus-ops/received_events", + "url": "https://api.github.com/users/datastore", + "html_url": "https://github.com/datastore", + "followers_url": "https://api.github.com/users/datastore/followers", + "following_url": "https://api.github.com/users/datastore/following{/other_user}", + "gists_url": "https://api.github.com/users/datastore/gists{/gist_id}", + "starred_url": "https://api.github.com/users/datastore/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/datastore/subscriptions", + "organizations_url": "https://api.github.com/users/datastore/orgs", + "repos_url": "https://api.github.com/users/datastore/repos", + "events_url": "https://api.github.com/users/datastore/events{/privacy}", + "received_events_url": "https://api.github.com/users/datastore/received_events", "type": "Organization", "site_admin": false }, "repository_selection": "all", - "access_tokens_url": "https://api.github.com/app/installations/50862096/access_tokens", + "access_tokens_url": "https://api.github.com/app/installations/50263360/access_tokens", "repositories_url": "https://api.github.com/installation/repositories", - "html_url": "https://github.com/organizations/commonhaus-ops/settings/installations/50862096", + "html_url": "https://github.com/organizations/datastore/settings/installations/50263360", "app_id": 794963, "app_slug": "commonhaus-test-bot", - "target_id": 168359006, + "target_id": 168673220, "target_type": "Organization", "permissions": { "members": "write", @@ -72,10 +72,10 @@ }, "repositories": [ { - "id": 731361812, - "node_id": "R_kgDOK5eyFA", + "id": 801851090, + "node_id": "R_datastore", "name": "org", - "full_name": "commonhaus-ops/org", + "full_name": "datastore/org", "private": true } ], diff --git a/cf-admin-bot/src/test/resources/github/eventIssueLabeled-accepted.json b/cf-admin-bot/src/test/resources/github/eventIssueLabeled-accepted.json index f7fc90b..674583d 100644 --- a/cf-admin-bot/src/test/resources/github/eventIssueLabeled-accepted.json +++ b/cf-admin-bot/src/test/resources/github/eventIssueLabeled-accepted.json @@ -1,12 +1,12 @@ { "action": "labeled", "issue": { - "url": "https://api.github.com/repos/commonhaus-test/ops-test/issues/6", - "repository_url": "https://api.github.com/repos/commonhaus-test/ops-test", - "labels_url": "https://api.github.com/repos/commonhaus-test/ops-test/issues/6/labels{/name}", - "comments_url": "https://api.github.com/repos/commonhaus-test/ops-test/issues/6/comments", - "events_url": "https://api.github.com/repos/commonhaus-test/ops-test/issues/6/events", - "html_url": "https://github.com/commonhaus-test/ops-test/issues/6", + "url": "https://api.github.com/repos/datastore/org/issues/6", + "repository_url": "https://api.github.com/repos/datastore/org", + "labels_url": "https://api.github.com/repos/datastore/org/issues/6/labels{/name}", + "comments_url": "https://api.github.com/repos/datastore/org/issues/6/comments", + "events_url": "https://api.github.com/repos/datastore/org/issues/6/events", + "html_url": "https://github.com/datastore/org/issues/6", "id": 2345115049, "node_id": "I_kwDOL8tG0s6Lx52p", "number": 6, @@ -35,7 +35,7 @@ { "id": 7065603553, "node_id": "LA_kwDOL8tG0s8AAAABpSSN4Q", - "url": "https://api.github.com/repos/commonhaus-test/ops-test/labels/application/accepted", + "url": "https://api.github.com/repos/datastore/org/labels/application/accepted", "name": "application/accepted", "color": "C7ECB7", "default": false, @@ -57,7 +57,7 @@ "active_lock_reason": null, "body": "[ebullient](https://github.com/ebullient)\n\n> [!TIP]\n> - Include \"::response::\" in your comment to send feedback to the applicant.\n> - Add the 'application/accepted' label to accept the application.\n> - Add the 'application/declined' label to decline or reject the application.\n\n## Contribution Details\n\nTry again. I think the old one was lost.\n\n\n## Additional Notes\n\nStatus: PENDING\r\nRoles: cfc, egc, sponsor\n\n", "reactions": { - "url": "https://api.github.com/repos/commonhaus-test/ops-test/issues/6/reactions", + "url": "https://api.github.com/repos/datastore/org/issues/6/reactions", "total_count": 0, "+1": 0, "-1": 0, @@ -68,14 +68,14 @@ "rocket": 0, "eyes": 0 }, - "timeline_url": "https://api.github.com/repos/commonhaus-test/ops-test/issues/6/timeline", + "timeline_url": "https://api.github.com/repos/datastore/org/issues/6/timeline", "performed_via_github_app": null, "state_reason": "reopened" }, "label": { "id": 7065603553, "node_id": "LA_kwDOL8tG0s8AAAABpSSN4Q", - "url": "https://api.github.com/repos/commonhaus-test/ops-test/labels/application/accepted", + "url": "https://api.github.com/repos/datastore/org/labels/application/accepted", "name": "application/accepted", "color": "C7ECB7", "default": false, @@ -83,77 +83,77 @@ }, "repository": { "id": 801851090, - "node_id": "R_kgDOL8tG0g", - "name": "ops-test", - "full_name": "commonhaus-test/ops-test", + "node_id": "R_datastore", + "name": "org", + "full_name": "datastore/org", "private": true, "owner": { - "login": "commonhaus-test", - "id": 168673220, - "node_id": "O_kgDOCg2_xA", + "login": "datastore", + "id": 801851090, + "node_id": "O_datastore", "avatar_url": "https://avatars.githubusercontent.com/u/168673220?v=4", "gravatar_id": "", - "url": "https://api.github.com/users/commonhaus-test", - "html_url": "https://github.com/commonhaus-test", - "followers_url": "https://api.github.com/users/commonhaus-test/followers", - "following_url": "https://api.github.com/users/commonhaus-test/following{/other_user}", - "gists_url": "https://api.github.com/users/commonhaus-test/gists{/gist_id}", - "starred_url": "https://api.github.com/users/commonhaus-test/starred{/owner}{/repo}", - "subscriptions_url": "https://api.github.com/users/commonhaus-test/subscriptions", - "organizations_url": "https://api.github.com/users/commonhaus-test/orgs", - "repos_url": "https://api.github.com/users/commonhaus-test/repos", - "events_url": "https://api.github.com/users/commonhaus-test/events{/privacy}", - "received_events_url": "https://api.github.com/users/commonhaus-test/received_events", + "url": "https://api.github.com/users/datastore", + "html_url": "https://github.com/datastore", + "followers_url": "https://api.github.com/users/datastore/followers", + "following_url": "https://api.github.com/users/datastore/following{/other_user}", + "gists_url": "https://api.github.com/users/datastore/gists{/gist_id}", + "starred_url": "https://api.github.com/users/datastore/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/datastore/subscriptions", + "organizations_url": "https://api.github.com/users/datastore/orgs", + "repos_url": "https://api.github.com/users/datastore/repos", + "events_url": "https://api.github.com/users/datastore/events{/privacy}", + "received_events_url": "https://api.github.com/users/datastore/received_events", "type": "Organization", "site_admin": false }, - "html_url": "https://github.com/commonhaus-test/ops-test", + "html_url": "https://github.com/datastore/org", "description": null, "fork": false, - "url": "https://api.github.com/repos/commonhaus-test/ops-test", - "forks_url": "https://api.github.com/repos/commonhaus-test/ops-test/forks", - "keys_url": "https://api.github.com/repos/commonhaus-test/ops-test/keys{/key_id}", - "collaborators_url": "https://api.github.com/repos/commonhaus-test/ops-test/collaborators{/collaborator}", - "teams_url": "https://api.github.com/repos/commonhaus-test/ops-test/teams", - "hooks_url": "https://api.github.com/repos/commonhaus-test/ops-test/hooks", - "issue_events_url": "https://api.github.com/repos/commonhaus-test/ops-test/issues/events{/number}", - "events_url": "https://api.github.com/repos/commonhaus-test/ops-test/events", - "assignees_url": "https://api.github.com/repos/commonhaus-test/ops-test/assignees{/user}", - "branches_url": "https://api.github.com/repos/commonhaus-test/ops-test/branches{/branch}", - "tags_url": "https://api.github.com/repos/commonhaus-test/ops-test/tags", - "blobs_url": "https://api.github.com/repos/commonhaus-test/ops-test/git/blobs{/sha}", - "git_tags_url": "https://api.github.com/repos/commonhaus-test/ops-test/git/tags{/sha}", - "git_refs_url": "https://api.github.com/repos/commonhaus-test/ops-test/git/refs{/sha}", - "trees_url": "https://api.github.com/repos/commonhaus-test/ops-test/git/trees{/sha}", - "statuses_url": "https://api.github.com/repos/commonhaus-test/ops-test/statuses/{sha}", - "languages_url": "https://api.github.com/repos/commonhaus-test/ops-test/languages", - "stargazers_url": "https://api.github.com/repos/commonhaus-test/ops-test/stargazers", - "contributors_url": "https://api.github.com/repos/commonhaus-test/ops-test/contributors", - "subscribers_url": "https://api.github.com/repos/commonhaus-test/ops-test/subscribers", - "subscription_url": "https://api.github.com/repos/commonhaus-test/ops-test/subscription", - "commits_url": "https://api.github.com/repos/commonhaus-test/ops-test/commits{/sha}", - "git_commits_url": "https://api.github.com/repos/commonhaus-test/ops-test/git/commits{/sha}", - "comments_url": "https://api.github.com/repos/commonhaus-test/ops-test/comments{/number}", - "issue_comment_url": "https://api.github.com/repos/commonhaus-test/ops-test/issues/comments{/number}", - "contents_url": "https://api.github.com/repos/commonhaus-test/ops-test/contents/{+path}", - "compare_url": "https://api.github.com/repos/commonhaus-test/ops-test/compare/{base}...{head}", - "merges_url": "https://api.github.com/repos/commonhaus-test/ops-test/merges", - "archive_url": "https://api.github.com/repos/commonhaus-test/ops-test/{archive_format}{/ref}", - "downloads_url": "https://api.github.com/repos/commonhaus-test/ops-test/downloads", - "issues_url": "https://api.github.com/repos/commonhaus-test/ops-test/issues{/number}", - "pulls_url": "https://api.github.com/repos/commonhaus-test/ops-test/pulls{/number}", - "milestones_url": "https://api.github.com/repos/commonhaus-test/ops-test/milestones{/number}", - "notifications_url": "https://api.github.com/repos/commonhaus-test/ops-test/notifications{?since,all,participating}", - "labels_url": "https://api.github.com/repos/commonhaus-test/ops-test/labels{/name}", - "releases_url": "https://api.github.com/repos/commonhaus-test/ops-test/releases{/id}", - "deployments_url": "https://api.github.com/repos/commonhaus-test/ops-test/deployments", + "url": "https://api.github.com/repos/datastore/org", + "forks_url": "https://api.github.com/repos/datastore/org/forks", + "keys_url": "https://api.github.com/repos/datastore/org/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/datastore/org/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/datastore/org/teams", + "hooks_url": "https://api.github.com/repos/datastore/org/hooks", + "issue_events_url": "https://api.github.com/repos/datastore/org/issues/events{/number}", + "events_url": "https://api.github.com/repos/datastore/org/events", + "assignees_url": "https://api.github.com/repos/datastore/org/assignees{/user}", + "branches_url": "https://api.github.com/repos/datastore/org/branches{/branch}", + "tags_url": "https://api.github.com/repos/datastore/org/tags", + "blobs_url": "https://api.github.com/repos/datastore/org/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/datastore/org/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/datastore/org/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/datastore/org/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/datastore/org/statuses/{sha}", + "languages_url": "https://api.github.com/repos/datastore/org/languages", + "stargazers_url": "https://api.github.com/repos/datastore/org/stargazers", + "contributors_url": "https://api.github.com/repos/datastore/org/contributors", + "subscribers_url": "https://api.github.com/repos/datastore/org/subscribers", + "subscription_url": "https://api.github.com/repos/datastore/org/subscription", + "commits_url": "https://api.github.com/repos/datastore/org/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/datastore/org/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/datastore/org/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/datastore/org/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/datastore/org/contents/{+path}", + "compare_url": "https://api.github.com/repos/datastore/org/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/datastore/org/merges", + "archive_url": "https://api.github.com/repos/datastore/org/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/datastore/org/downloads", + "issues_url": "https://api.github.com/repos/datastore/org/issues{/number}", + "pulls_url": "https://api.github.com/repos/datastore/org/pulls{/number}", + "milestones_url": "https://api.github.com/repos/datastore/org/milestones{/number}", + "notifications_url": "https://api.github.com/repos/datastore/org/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/datastore/org/labels{/name}", + "releases_url": "https://api.github.com/repos/datastore/org/releases{/id}", + "deployments_url": "https://api.github.com/repos/datastore/org/deployments", "created_at": "2024-05-17T03:23:20Z", "updated_at": "2024-06-11T01:37:05Z", "pushed_at": "2024-06-11T01:37:02Z", - "git_url": "git://github.com/commonhaus-test/ops-test.git", - "ssh_url": "git@github.com:commonhaus-test/ops-test.git", - "clone_url": "https://github.com/commonhaus-test/ops-test.git", - "svn_url": "https://github.com/commonhaus-test/ops-test", + "git_url": "git://github.com/datastore/org.git", + "ssh_url": "git@github.com:datastore/org.git", + "clone_url": "https://github.com/datastore/org.git", + "svn_url": "https://github.com/datastore/org", "homepage": null, "size": 92, "stargazers_count": 0, @@ -187,16 +187,16 @@ } }, "organization": { - "login": "commonhaus-test", - "id": 168673220, - "node_id": "O_kgDOCg2_xA", - "url": "https://api.github.com/orgs/commonhaus-test", - "repos_url": "https://api.github.com/orgs/commonhaus-test/repos", - "events_url": "https://api.github.com/orgs/commonhaus-test/events", - "hooks_url": "https://api.github.com/orgs/commonhaus-test/hooks", - "issues_url": "https://api.github.com/orgs/commonhaus-test/issues", - "members_url": "https://api.github.com/orgs/commonhaus-test/members{/member}", - "public_members_url": "https://api.github.com/orgs/commonhaus-test/public_members{/member}", + "login": "datastore", + "id": 801851090, + "node_id": "O_datastore", + "url": "https://api.github.com/orgs/datastore", + "repos_url": "https://api.github.com/orgs/datastore/repos", + "events_url": "https://api.github.com/orgs/datastore/events", + "hooks_url": "https://api.github.com/orgs/datastore/hooks", + "issues_url": "https://api.github.com/orgs/datastore/issues", + "members_url": "https://api.github.com/orgs/datastore/members{/member}", + "public_members_url": "https://api.github.com/orgs/datastore/public_members{/member}", "avatar_url": "https://avatars.githubusercontent.com/u/168673220?v=4", "description": "" }, @@ -221,7 +221,7 @@ "site_admin": false }, "installation": { - "id": 50263360, + "id": 50264360, "node_id": "MDIzOkludGVncmF0aW9uSW5zdGFsbGF0aW9uNTAyNjMzNjA=" } } diff --git a/cf-admin-bot/src/test/resources/github/eventIssueLabeled-declined.json b/cf-admin-bot/src/test/resources/github/eventIssueLabeled-declined.json index d8dade3..73cb9eb 100644 --- a/cf-admin-bot/src/test/resources/github/eventIssueLabeled-declined.json +++ b/cf-admin-bot/src/test/resources/github/eventIssueLabeled-declined.json @@ -1,12 +1,12 @@ { "action": "labeled", "issue": { - "url": "https://api.github.com/repos/commonhaus-test/ops-test/issues/6", - "repository_url": "https://api.github.com/repos/commonhaus-test/ops-test", - "labels_url": "https://api.github.com/repos/commonhaus-test/ops-test/issues/6/labels{/name}", - "comments_url": "https://api.github.com/repos/commonhaus-test/ops-test/issues/6/comments", - "events_url": "https://api.github.com/repos/commonhaus-test/ops-test/issues/6/events", - "html_url": "https://github.com/commonhaus-test/ops-test/issues/6", + "url": "https://api.github.com/repos/datastore/org/issues/6", + "repository_url": "https://api.github.com/repos/datastore/org", + "labels_url": "https://api.github.com/repos/datastore/org/issues/6/labels{/name}", + "comments_url": "https://api.github.com/repos/datastore/org/issues/6/comments", + "events_url": "https://api.github.com/repos/datastore/org/issues/6/events", + "html_url": "https://github.com/datastore/org/issues/6", "id": 2345115049, "node_id": "I_kwDOL8tG0s6Lx52p", "number": 6, @@ -35,7 +35,7 @@ { "id": 7065603553, "node_id": "LA_kwDOL8tG0s8AAAABpSSN4Q", - "url": "https://api.github.com/repos/commonhaus-test/ops-test/labels/application/accepted", + "url": "https://api.github.com/repos/datastore/org/labels/application/accepted", "name": "application/accepted", "color": "C7ECB7", "default": false, @@ -57,7 +57,7 @@ "active_lock_reason": null, "body": "[ebullient](https://github.com/ebullient)\n\n> [!TIP]\n> - Include \"::response::\" in your comment to send feedback to the applicant.\n> - Add the 'application/accepted' label to accept the application.\n> - Add the 'application/declined' label to decline or reject the application.\n\n## Contribution Details\n\nTry again. I think the old one was lost.\n\n\n## Additional Notes\n\nStatus: PENDING\r\nRoles: cfc, egc, sponsor\n\n", "reactions": { - "url": "https://api.github.com/repos/commonhaus-test/ops-test/issues/6/reactions", + "url": "https://api.github.com/repos/datastore/org/issues/6/reactions", "total_count": 0, "+1": 0, "-1": 0, @@ -68,14 +68,14 @@ "rocket": 0, "eyes": 0 }, - "timeline_url": "https://api.github.com/repos/commonhaus-test/ops-test/issues/6/timeline", + "timeline_url": "https://api.github.com/repos/datastore/org/issues/6/timeline", "performed_via_github_app": null, "state_reason": "reopened" }, "label": { "id": 7065603903, "node_id": "LA_kwDOKRPTI88AAAABhGp_7g", - "url": "https://api.github.com/repos/commonhaus-test/ops-test/labels/application/declined", + "url": "https://api.github.com/repos/datastore/org/labels/application/declined", "name": "application/declined", "color": "C7ECB7", "default": false, @@ -83,77 +83,77 @@ }, "repository": { "id": 801851090, - "node_id": "R_kgDOL8tG0g", - "name": "ops-test", - "full_name": "commonhaus-test/ops-test", + "node_id": "R_datastore", + "name": "org", + "full_name": "datastore/org", "private": true, "owner": { - "login": "commonhaus-test", + "login": "datastore", "id": 168673220, - "node_id": "O_kgDOCg2_xA", + "node_id": "O_datastore", "avatar_url": "https://avatars.githubusercontent.com/u/168673220?v=4", "gravatar_id": "", - "url": "https://api.github.com/users/commonhaus-test", - "html_url": "https://github.com/commonhaus-test", - "followers_url": "https://api.github.com/users/commonhaus-test/followers", - "following_url": "https://api.github.com/users/commonhaus-test/following{/other_user}", - "gists_url": "https://api.github.com/users/commonhaus-test/gists{/gist_id}", - "starred_url": "https://api.github.com/users/commonhaus-test/starred{/owner}{/repo}", - "subscriptions_url": "https://api.github.com/users/commonhaus-test/subscriptions", - "organizations_url": "https://api.github.com/users/commonhaus-test/orgs", - "repos_url": "https://api.github.com/users/commonhaus-test/repos", - "events_url": "https://api.github.com/users/commonhaus-test/events{/privacy}", - "received_events_url": "https://api.github.com/users/commonhaus-test/received_events", + "url": "https://api.github.com/users/datastore", + "html_url": "https://github.com/datastore", + "followers_url": "https://api.github.com/users/datastore/followers", + "following_url": "https://api.github.com/users/datastore/following{/other_user}", + "gists_url": "https://api.github.com/users/datastore/gists{/gist_id}", + "starred_url": "https://api.github.com/users/datastore/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/datastore/subscriptions", + "organizations_url": "https://api.github.com/users/datastore/orgs", + "repos_url": "https://api.github.com/users/datastore/repos", + "events_url": "https://api.github.com/users/datastore/events{/privacy}", + "received_events_url": "https://api.github.com/users/datastore/received_events", "type": "Organization", "site_admin": false }, - "html_url": "https://github.com/commonhaus-test/ops-test", + "html_url": "https://github.com/datastore/org", "description": null, "fork": false, - "url": "https://api.github.com/repos/commonhaus-test/ops-test", - "forks_url": "https://api.github.com/repos/commonhaus-test/ops-test/forks", - "keys_url": "https://api.github.com/repos/commonhaus-test/ops-test/keys{/key_id}", - "collaborators_url": "https://api.github.com/repos/commonhaus-test/ops-test/collaborators{/collaborator}", - "teams_url": "https://api.github.com/repos/commonhaus-test/ops-test/teams", - "hooks_url": "https://api.github.com/repos/commonhaus-test/ops-test/hooks", - "issue_events_url": "https://api.github.com/repos/commonhaus-test/ops-test/issues/events{/number}", - "events_url": "https://api.github.com/repos/commonhaus-test/ops-test/events", - "assignees_url": "https://api.github.com/repos/commonhaus-test/ops-test/assignees{/user}", - "branches_url": "https://api.github.com/repos/commonhaus-test/ops-test/branches{/branch}", - "tags_url": "https://api.github.com/repos/commonhaus-test/ops-test/tags", - "blobs_url": "https://api.github.com/repos/commonhaus-test/ops-test/git/blobs{/sha}", - "git_tags_url": "https://api.github.com/repos/commonhaus-test/ops-test/git/tags{/sha}", - "git_refs_url": "https://api.github.com/repos/commonhaus-test/ops-test/git/refs{/sha}", - "trees_url": "https://api.github.com/repos/commonhaus-test/ops-test/git/trees{/sha}", - "statuses_url": "https://api.github.com/repos/commonhaus-test/ops-test/statuses/{sha}", - "languages_url": "https://api.github.com/repos/commonhaus-test/ops-test/languages", - "stargazers_url": "https://api.github.com/repos/commonhaus-test/ops-test/stargazers", - "contributors_url": "https://api.github.com/repos/commonhaus-test/ops-test/contributors", - "subscribers_url": "https://api.github.com/repos/commonhaus-test/ops-test/subscribers", - "subscription_url": "https://api.github.com/repos/commonhaus-test/ops-test/subscription", - "commits_url": "https://api.github.com/repos/commonhaus-test/ops-test/commits{/sha}", - "git_commits_url": "https://api.github.com/repos/commonhaus-test/ops-test/git/commits{/sha}", - "comments_url": "https://api.github.com/repos/commonhaus-test/ops-test/comments{/number}", - "issue_comment_url": "https://api.github.com/repos/commonhaus-test/ops-test/issues/comments{/number}", - "contents_url": "https://api.github.com/repos/commonhaus-test/ops-test/contents/{+path}", - "compare_url": "https://api.github.com/repos/commonhaus-test/ops-test/compare/{base}...{head}", - "merges_url": "https://api.github.com/repos/commonhaus-test/ops-test/merges", - "archive_url": "https://api.github.com/repos/commonhaus-test/ops-test/{archive_format}{/ref}", - "downloads_url": "https://api.github.com/repos/commonhaus-test/ops-test/downloads", - "issues_url": "https://api.github.com/repos/commonhaus-test/ops-test/issues{/number}", - "pulls_url": "https://api.github.com/repos/commonhaus-test/ops-test/pulls{/number}", - "milestones_url": "https://api.github.com/repos/commonhaus-test/ops-test/milestones{/number}", - "notifications_url": "https://api.github.com/repos/commonhaus-test/ops-test/notifications{?since,all,participating}", - "labels_url": "https://api.github.com/repos/commonhaus-test/ops-test/labels{/name}", - "releases_url": "https://api.github.com/repos/commonhaus-test/ops-test/releases{/id}", - "deployments_url": "https://api.github.com/repos/commonhaus-test/ops-test/deployments", + "url": "https://api.github.com/repos/datastore/org", + "forks_url": "https://api.github.com/repos/datastore/org/forks", + "keys_url": "https://api.github.com/repos/datastore/org/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/datastore/org/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/datastore/org/teams", + "hooks_url": "https://api.github.com/repos/datastore/org/hooks", + "issue_events_url": "https://api.github.com/repos/datastore/org/issues/events{/number}", + "events_url": "https://api.github.com/repos/datastore/org/events", + "assignees_url": "https://api.github.com/repos/datastore/org/assignees{/user}", + "branches_url": "https://api.github.com/repos/datastore/org/branches{/branch}", + "tags_url": "https://api.github.com/repos/datastore/org/tags", + "blobs_url": "https://api.github.com/repos/datastore/org/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/datastore/org/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/datastore/org/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/datastore/org/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/datastore/org/statuses/{sha}", + "languages_url": "https://api.github.com/repos/datastore/org/languages", + "stargazers_url": "https://api.github.com/repos/datastore/org/stargazers", + "contributors_url": "https://api.github.com/repos/datastore/org/contributors", + "subscribers_url": "https://api.github.com/repos/datastore/org/subscribers", + "subscription_url": "https://api.github.com/repos/datastore/org/subscription", + "commits_url": "https://api.github.com/repos/datastore/org/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/datastore/org/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/datastore/org/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/datastore/org/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/datastore/org/contents/{+path}", + "compare_url": "https://api.github.com/repos/datastore/org/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/datastore/org/merges", + "archive_url": "https://api.github.com/repos/datastore/org/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/datastore/org/downloads", + "issues_url": "https://api.github.com/repos/datastore/org/issues{/number}", + "pulls_url": "https://api.github.com/repos/datastore/org/pulls{/number}", + "milestones_url": "https://api.github.com/repos/datastore/org/milestones{/number}", + "notifications_url": "https://api.github.com/repos/datastore/org/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/datastore/org/labels{/name}", + "releases_url": "https://api.github.com/repos/datastore/org/releases{/id}", + "deployments_url": "https://api.github.com/repos/datastore/org/deployments", "created_at": "2024-05-17T03:23:20Z", "updated_at": "2024-06-11T01:37:05Z", "pushed_at": "2024-06-11T01:37:02Z", - "git_url": "git://github.com/commonhaus-test/ops-test.git", - "ssh_url": "git@github.com:commonhaus-test/ops-test.git", - "clone_url": "https://github.com/commonhaus-test/ops-test.git", - "svn_url": "https://github.com/commonhaus-test/ops-test", + "git_url": "git://github.com/datastore/org.git", + "ssh_url": "git@github.com:datastore/org.git", + "clone_url": "https://github.com/datastore/org.git", + "svn_url": "https://github.com/datastore/org", "homepage": null, "size": 92, "stargazers_count": 0, @@ -187,16 +187,16 @@ } }, "organization": { - "login": "commonhaus-test", - "id": 168673220, - "node_id": "O_kgDOCg2_xA", - "url": "https://api.github.com/orgs/commonhaus-test", - "repos_url": "https://api.github.com/orgs/commonhaus-test/repos", - "events_url": "https://api.github.com/orgs/commonhaus-test/events", - "hooks_url": "https://api.github.com/orgs/commonhaus-test/hooks", - "issues_url": "https://api.github.com/orgs/commonhaus-test/issues", - "members_url": "https://api.github.com/orgs/commonhaus-test/members{/member}", - "public_members_url": "https://api.github.com/orgs/commonhaus-test/public_members{/member}", + "login": "datastore", + "id": 801851090, + "node_id": "O_datastore", + "url": "https://api.github.com/orgs/datastore", + "repos_url": "https://api.github.com/orgs/datastore/repos", + "events_url": "https://api.github.com/orgs/datastore/events", + "hooks_url": "https://api.github.com/orgs/datastore/hooks", + "issues_url": "https://api.github.com/orgs/datastore/issues", + "members_url": "https://api.github.com/orgs/datastore/members{/member}", + "public_members_url": "https://api.github.com/orgs/datastore/public_members{/member}", "avatar_url": "https://avatars.githubusercontent.com/u/168673220?v=4", "description": "" }, @@ -221,7 +221,7 @@ "site_admin": false }, "installation": { - "id": 50263360, + "id": 50264360, "node_id": "MDIzOkludGVncmF0aW9uSW5zdGFsbGF0aW9uNTAyNjMzNjA=" } } diff --git a/cf-admin-bot/src/test/resources/github/mutableUpdateIssue.json b/cf-admin-bot/src/test/resources/github/mutableUpdateIssue.json index 6bd55ae..e9c51f2 100644 --- a/cf-admin-bot/src/test/resources/github/mutableUpdateIssue.json +++ b/cf-admin-bot/src/test/resources/github/mutableUpdateIssue.json @@ -7,7 +7,7 @@ "login": "commonhaus-bot", "url": "https://api.github.com/users/commonhaus-bot" }, - "url": "https://github.com/commonhaus-test/ops-test/issues/1", + "url": "https://github.com/datastore/org/issues/1", "number": 1, "title": "Membership application: Any Name (commonhaus-bot)", "body": "[commonhaus-bot](null)\n\n> [!TIP]\n> - Include \"::response::\" in your comment to send feedback to the applicant.\n> - Add the 'application/accepted' label to accept the application.\n> - Add the 'application/declined' label to decline or reject the application.\n## Contribution Details\n\ntestContrib\n\n\n## Additional Notes\n\ntestNotes\n", diff --git a/cf-admin-bot/src/test/resources/github/queryComments.json b/cf-admin-bot/src/test/resources/github/queryComments.json index ceca7a9..c06cbf7 100644 --- a/cf-admin-bot/src/test/resources/github/queryComments.json +++ b/cf-admin-bot/src/test/resources/github/queryComments.json @@ -12,7 +12,7 @@ "body": "::response::\r\n\r\nFeedback", "createdAt": "2024-06-05T21:19:22Z", "updatedAt": "2024-06-05T21:19:22Z", - "url": "https://github.com/commonhaus-test/ops-test/issues/1#issuecomment-2150980060", + "url": "https://github.com/datastore/org/issues/1#issuecomment-2150980060", "databaseId": 2150980060 }, { @@ -25,7 +25,7 @@ "body": "adding a comment\r\n", "createdAt": "2024-06-05T21:18:48Z", "updatedAt": "2024-06-05T21:18:48Z", - "url": "https://github.com/commonhaus-test/ops-test/issues/1#issuecomment-2150979441", + "url": "https://github.com/datastore/org/issues/1#issuecomment-2150979441", "databaseId": 2150979441 }, { @@ -38,7 +38,7 @@ "body": "::response::\r\n\r\nOLD Feedback", "createdAt": "2024-06-04T21:19:22Z", "updatedAt": "2024-06-05T20:54:05Z", - "url": "https://github.com/commonhaus-test/ops-test/issues/1#issuecomment-2150980060", + "url": "https://github.com/datastore/org/issues/1#issuecomment-2150980060", "databaseId": 2150980060 } ] diff --git a/cf-admin-bot/src/test/resources/github/queryIssue-ApplicationBadTitle.json b/cf-admin-bot/src/test/resources/github/queryIssue-ApplicationBadTitle.json index c2deb06..b2fd9e7 100644 --- a/cf-admin-bot/src/test/resources/github/queryIssue-ApplicationBadTitle.json +++ b/cf-admin-bot/src/test/resources/github/queryIssue-ApplicationBadTitle.json @@ -9,7 +9,7 @@ "body": "", "createdAt": "2024-06-05T20:56:05Z", "updatedAt": "2024-06-05T20:56:05Z", - "url": "https://github.com/commonhaus-test/ops-test/issues/1", + "url": "https://github.com/datastore/org/issues/1", "number": 1, "title": "Test issue", "closed": false, diff --git a/cf-admin-bot/src/test/resources/github/queryIssue-ApplicationMatch.json b/cf-admin-bot/src/test/resources/github/queryIssue-ApplicationMatch.json index aa5a161..ae988dc 100644 --- a/cf-admin-bot/src/test/resources/github/queryIssue-ApplicationMatch.json +++ b/cf-admin-bot/src/test/resources/github/queryIssue-ApplicationMatch.json @@ -10,7 +10,7 @@ "createdAt": "2024-06-05T20:56:05Z", "lastEditedAt": "2024-06-05T20:56:05Z", "updatedAt": "2024-06-05T21:20:22Z", - "url": "https://github.com/commonhaus-test/ops-test/issues/1", + "url": "https://github.com/datastore/org/issues/1", "number": 1, "title": "Membership application: Any Name (commonhaus-bot)", "closed": false,