fix(prd-1): skip actor check on Forgejo (no bot accounts, avoids read:user scope)

This commit is contained in:
Vlad Mocanu committed 2026-02-25 19:40:24 +02:00
1 parent 6eb2e41510
commit ead98f44f9
2 files changed
+72 -7

No files matched your search

+10 -3
View File
@@ -7,11 +7,21 @@
import type { Octokit } from "@octokit/rest";
import type { GitHubContext } from "../context";
import { detectPlatform } from "../../platform/detector";
export async function checkHumanActor(
octokit: Octokit,
githubContext: GitHubContext,
) {
// Forgejo doesn't have GitHub-style bot/app accounts, and the user API
// requires read:user scope which may not be available. Skip entirely.
if (detectPlatform() === "forgejo") {
console.log(
`Skipping human actor check on Forgejo for: ${githubContext.actor}`,
);
return;
}
// Fetch user information from GitHub API
const { data: userData } = await octokit.users.getByUsername({
username: githubContext.actor,
@@ -21,9 +31,6 @@ export async function checkHumanActor(
console.log(`Actor type: ${actorType}`);
// On Forgejo, the user API doesn't return a `type` field (undefined).
// Treat undefined/empty type as a human user — Forgejo doesn't have
// GitHub-style bot/app accounts.
if (actorType && actorType !== "User") {
const allowedBots = githubContext.inputs.allowedBots;