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

Method runPolicyCheck

templates/panda/PolicyPanda.java:159–197  ·  view source on GitHub ↗
(List<GHRepository> repos)

Source from the content-addressed store, hash-verified

157 }
158
159 private void runPolicyCheck(List<GHRepository> repos) throws IOException {
160 log.info("🌳 Running policy check...");
161
162 CommunityFiles orgFiles;
163 if (orgDotGithubRepo != null) {
164 orgFiles = findCommunityFiles(orgDotGithubRepo);
165 if (orgFiles.governance() != null) {
166 addCheck(orgDotGithubRepo,
167 new Item("Organization %s file found"
168 .formatted(orgFiles.governance().getName())));
169 }
170 if (orgFiles.codeOfConduct() != null) {
171 addCheck(orgDotGithubRepo,
172 new Item("Organization %s file found"
173 .formatted(orgFiles.codeOfConduct().getName())));
174 }
175 if (orgFiles.contributing() != null) {
176 addCheck(orgDotGithubRepo,
177 new Item("Organization %s file found"
178 .formatted(orgFiles.contributing().getName())));
179 }
180 } else {
181 orgFiles = new CommunityFiles(null, null, null);
182 }
183
184 // Process each repository
185 for (GHRepository repo : repos) {
186 processRepository(repo, orgFiles);
187 }
188
189 // Write policy report
190 String outputFile = outputDir + "/policy-report-" + organization + ".md";
191 try (PrintWriter writer = new PrintWriter(new FileWriter(outputFile))) {
192 writer.println("# Policy Compliance Report for " + organization + "\n");
193 writer.println("Generated on: " + java.time.LocalDateTime.now() + "\n");
194 checks.forEach(x -> writer.println(x.markdownSummary()));
195 }
196 log.info("✔️ Policy report written to " + outputFile);
197 }
198
199 private void processRepository(GHRepository repo, CommunityFiles orgFiles) throws IOException {
200 addCheck(repo, new Heading("🏡 " + repo.getFullName()));

Callers 1

runMethod · 0.95

Calls 4

findCommunityFilesMethod · 0.95
addCheckMethod · 0.95
processRepositoryMethod · 0.95
markdownSummaryMethod · 0.65

Tested by

no test coverage detected