fix(check): skip merge checks when user profile is private

This commit is contained in:
peaklabs-dev committed 2026-04-15 16:17:56 +02:00
1 parent 7814903fe3
commit f4b9e4959c
3 files changed
+13 -4

No files matched your search

+6
View File
@@ -6,9 +6,15 @@ export async function runMergeChecks(
settings: Settings,
context: Context,
client: Octokit,
isPrivateProfile: boolean,
): Promise<CheckResult[]> {
const results: CheckResult[] = [];
if (isPrivateProfile) {
core.info("[SKIP] merge-checks - Merge checks cannot be computed for private profiles");
return results;
}
const user = context.userLogin;
const repoFull = `${context.owner}/${context.repo}`;
const globalScope = settings.globalMergeRatioExcludeOwn ? `-user:${user}` : "";
+2 -2
View File
@@ -11,7 +11,7 @@ export async function runUserChecks(
settings: Settings,
context: Context,
client: Octokit,
): Promise<CheckResult[]> {
): Promise<{ results: CheckResult[]; isPrivateProfile: boolean }> {
const results: CheckResult[] = [];
const user = context.userLogin;
@@ -104,7 +104,7 @@ export async function runUserChecks(
});
}
return results;
return { results, isPrivateProfile: profile?.user_view_type !== "public" };
}
async function getUserProfile(client: Octokit, username: string): Promise<UserProfile> {
+5 -2
View File
@@ -76,11 +76,14 @@ export async function run(): Promise<void> {
core.endGroup();
core.startGroup("User checks");
results.push(...(await runUserChecks(settings, context, client)));
const userChecks = await runUserChecks(settings, context, client);
results.push(...userChecks.results);
core.endGroup();
core.startGroup("Merge checks");
results.push(...(await runMergeChecks(settings, context, client)));
results.push(
...(await runMergeChecks(settings, context, client, userChecks.isPrivateProfile)),
);
core.endGroup();
} else {
core.warning("No valid GitHub token — checks requiring the GitHub API were skipped");