MCPcopy Create free account
hub / github.com/commonhaus/foundation / run

Method run

templates/panda/PolicyPanda.java:97–157  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

95 }
96
97 @Override
98 public void run() {
99 printHeader();
100 try {
101 // Setup output directory
102 ensureDirectoryExists(outputDir);
103
104 // Connect to GitHub
105 GitHub github = setupGitHubClient();
106 GHOrganization org = github.getOrganization(organization);
107 if (org == null) {
108 log.severe("Organization not found: " + organization);
109 return;
110 }
111 log.info("❇️ Inspecting organization " + org.getLogin());
112
113 // Initialize projectId if not provided
114 if (projectId == null) {
115 projectId = organization.toLowerCase();
116 }
117
118 // Get the organization's .github repo if it exists
119 try {
120 orgDotGithubRepo = github.getRepository(organization + "/.github");
121 log.info("Found organization .github repository");
122 } catch (IOException e) {
123 log.info("No organization .github repository found");
124 }
125
126 // Fetch all repositories based on regex
127 log.info("Fetching repositories matching pattern: " + repoRegex);
128 Pattern repoPattern = Pattern.compile(repoRegex);
129 List<GHRepository> allRepos = org.listRepositories().toList();
130 List<GHRepository> filteredRepos = allRepos.stream()
131 .filter(repo -> !repo.getName().equals(".github"))
132 .filter(repo -> repoPattern.matcher(repo.getName()).matches())
133 .filter(repo -> !(!includeArchived && repo.isArchived()))
134 .toList();
135 log.info("Found " + filteredRepos.size() + " repositories matching the pattern");
136
137 // Execute selected reports
138
139 // Policy check is the default. Skip is intentional
140 if (!skipPolicyCheck) {
141 runPolicyCheck(filteredRepos);
142 }
143
144 if (runAssetDiscovery) {
145 runAssetDiscovery(org, filteredRepos);
146 }
147
148 if (runOrgSettings) {
149 runOrgSettingsReport(org);
150 }
151
152 log.info("🎉 All reports completed for " + organization);
153 } catch (IOException e) {
154 log.severe("Error: " + e);

Callers

nothing calls this directly

Calls 7

printHeaderMethod · 0.95
runPolicyCheckMethod · 0.95
runAssetDiscoveryMethod · 0.95
runOrgSettingsReportMethod · 0.95
ensureDirectoryExistsMethod · 0.80
setupGitHubClientMethod · 0.80
getRepositoryMethod · 0.80

Tested by

no test coverage detected