Initial commit

This commit is contained in:
Lina Tawfik
2025-05-19 08:32:32 -07:00
commit f66f337f4e
58 changed files with 8913 additions and 0 deletions

View File

@@ -0,0 +1,31 @@
#!/usr/bin/env bun
/**
* Check if the action trigger is from a human actor
* Prevents automated tools or bots from triggering Claude
*/
import type { Octokit } from "@octokit/rest";
import type { ParsedGitHubContext } from "../context";
export async function checkHumanActor(
octokit: Octokit,
githubContext: ParsedGitHubContext,
) {
// Fetch user information from GitHub API
const { data: userData } = await octokit.users.getByUsername({
username: githubContext.actor,
});
const actorType = userData.type;
console.log(`Actor type: ${actorType}`);
if (actorType !== "User") {
throw new Error(
`Workflow initiated by non-human actor: ${githubContext.actor} (type: ${actorType}).`,
);
}
console.log(`Verified human actor: ${githubContext.actor}`);
}