Update src/github/validation/actor.ts
This commit is contained in:
parent
5735f5b5d8
commit
5b8f8c1e14
@ -12,6 +12,16 @@ export async function checkHumanActor(
|
|||||||
octokit: Octokit,
|
octokit: Octokit,
|
||||||
githubContext: ParsedGitHubContext,
|
githubContext: ParsedGitHubContext,
|
||||||
) {
|
) {
|
||||||
|
|
||||||
|
if (process.env.OVERRIDE_BOT_USERNAMES){
|
||||||
|
if (process.env.OVERRIDE_BOT_USERNAMES.split(",").includes(githubContext.actor)){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
throw new Error(
|
||||||
|
`Workflow initiated by non-human actor: ${githubContext.actor}. Please add bot to OVERRIDE_BOT_USERNAMES`,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
// Fetch user information from GitHub API
|
// Fetch user information from GitHub API
|
||||||
const { data: userData } = await octokit.users.getByUsername({
|
const { data: userData } = await octokit.users.getByUsername({
|
||||||
username: githubContext.actor,
|
username: githubContext.actor,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user