mirror of
https://github.com/markwylde/claude-code-gitea-action.git
synced 2026-02-20 02:22:49 +08:00
Attempt to make this work
This commit is contained in:
@@ -13,10 +13,14 @@ export async function checkHumanActor(
|
||||
githubContext: ParsedGitHubContext,
|
||||
) {
|
||||
// Check if we're in a Gitea environment
|
||||
const isGitea = process.env.GITHUB_API_URL && !process.env.GITHUB_API_URL.includes('api.github.com');
|
||||
|
||||
const isGitea =
|
||||
process.env.GITHUB_API_URL &&
|
||||
!process.env.GITHUB_API_URL.includes("api.github.com");
|
||||
|
||||
if (isGitea) {
|
||||
console.log(`Detected Gitea environment, skipping actor type validation for: ${githubContext.actor}`);
|
||||
console.log(
|
||||
`Detected Gitea environment, skipping actor type validation for: ${githubContext.actor}`,
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -38,9 +42,14 @@ export async function checkHumanActor(
|
||||
|
||||
console.log(`Verified human actor: ${githubContext.actor}`);
|
||||
} catch (error) {
|
||||
console.warn(`Failed to check actor type for ${githubContext.actor}:`, error);
|
||||
|
||||
console.warn(
|
||||
`Failed to check actor type for ${githubContext.actor}:`,
|
||||
error,
|
||||
);
|
||||
|
||||
// For compatibility, assume human actor if API call fails
|
||||
console.log(`Assuming human actor due to API failure: ${githubContext.actor}`);
|
||||
console.log(
|
||||
`Assuming human actor due to API failure: ${githubContext.actor}`,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,8 +15,10 @@ export async function checkWritePermissions(
|
||||
const { repository, actor } = context;
|
||||
|
||||
// For Gitea compatibility, check if we're in a non-GitHub environment
|
||||
const isGitea = process.env.GITHUB_API_URL && !process.env.GITHUB_API_URL.includes('api.github.com');
|
||||
|
||||
const isGitea =
|
||||
process.env.GITHUB_API_URL &&
|
||||
!process.env.GITHUB_API_URL.includes("api.github.com");
|
||||
|
||||
if (isGitea) {
|
||||
core.info(`Detected Gitea environment, assuming actor has permissions`);
|
||||
return true;
|
||||
|
||||
@@ -15,7 +15,9 @@ export function checkContainsTrigger(context: ParsedGitHubContext): boolean {
|
||||
inputs: { assigneeTrigger, triggerPhrase, directPrompt },
|
||||
} = context;
|
||||
|
||||
console.log(`Checking trigger: event=${context.eventName}, action=${context.eventAction}, phrase='${triggerPhrase}', assignee='${assigneeTrigger}', direct='${directPrompt}'`);
|
||||
console.log(
|
||||
`Checking trigger: event=${context.eventName}, action=${context.eventAction}, phrase='${triggerPhrase}', assignee='${assigneeTrigger}', direct='${directPrompt}'`,
|
||||
);
|
||||
|
||||
// If direct prompt is provided, always trigger
|
||||
if (directPrompt) {
|
||||
@@ -29,7 +31,9 @@ export function checkContainsTrigger(context: ParsedGitHubContext): boolean {
|
||||
let triggerUser = assigneeTrigger?.replace(/^@/, "") || "";
|
||||
const assigneeUsername = context.payload.issue.assignee?.login || "";
|
||||
|
||||
console.log(`Checking assignee trigger: user='${triggerUser}', assignee='${assigneeUsername}'`);
|
||||
console.log(
|
||||
`Checking assignee trigger: user='${triggerUser}', assignee='${assigneeUsername}'`,
|
||||
);
|
||||
|
||||
if (triggerUser && assigneeUsername === triggerUser) {
|
||||
console.log(`Issue assigned to trigger user '${triggerUser}'`);
|
||||
|
||||
Reference in New Issue
Block a user