mirror of
https://github.com/markwylde/claude-code-gitea-action.git
synced 2026-07-12 04:59:02 +08:00
fix: skip auth setup for untriggered runs
This commit is contained in:
@@ -24,6 +24,23 @@ async function run() {
|
||||
// Auto-detect mode based on context
|
||||
const mode = getMode(context);
|
||||
|
||||
// Check trigger conditions before token setup so skipped events do not need
|
||||
// OIDC or GitHub App authentication.
|
||||
const containsTrigger = mode.shouldTrigger(context);
|
||||
|
||||
// Debug logging
|
||||
console.log(`Mode: ${mode.name}`);
|
||||
console.log(`Context prompt: ${context.inputs?.prompt || "NO PROMPT"}`);
|
||||
console.log(`Trigger result: ${containsTrigger}`);
|
||||
|
||||
// Set output for action.yml to check
|
||||
core.setOutput("contains_trigger", containsTrigger.toString());
|
||||
|
||||
if (!containsTrigger) {
|
||||
console.log("No trigger found, skipping remaining steps");
|
||||
return;
|
||||
}
|
||||
|
||||
// Setup GitHub token
|
||||
const githubToken = await setupGitHubToken();
|
||||
const octokit = createOctokit(githubToken);
|
||||
@@ -45,24 +62,6 @@ async function run() {
|
||||
}
|
||||
}
|
||||
|
||||
// Check trigger conditions
|
||||
const containsTrigger = mode.shouldTrigger(context);
|
||||
|
||||
// Debug logging
|
||||
console.log(`Mode: ${mode.name}`);
|
||||
console.log(`Context prompt: ${context.inputs?.prompt || "NO PROMPT"}`);
|
||||
console.log(`Trigger result: ${containsTrigger}`);
|
||||
|
||||
// Set output for action.yml to check
|
||||
core.setOutput("contains_trigger", containsTrigger.toString());
|
||||
|
||||
if (!containsTrigger) {
|
||||
console.log("No trigger found, skipping remaining steps");
|
||||
// Still set github_token output even when skipping
|
||||
core.setOutput("github_token", githubToken);
|
||||
return;
|
||||
}
|
||||
|
||||
// Step 5: Use the new modular prepare function
|
||||
const result = await prepare({
|
||||
context,
|
||||
|
||||
@@ -137,7 +137,7 @@ export function parseGitHubContext(): GitHubContext {
|
||||
},
|
||||
actor: context.actor,
|
||||
inputs: {
|
||||
prompt: process.env.PROMPT || "",
|
||||
prompt: process.env.PROMPT || process.env.DIRECT_PROMPT || "",
|
||||
triggerPhrase: process.env.TRIGGER_PHRASE ?? "@claude",
|
||||
assigneeTrigger: process.env.ASSIGNEE_TRIGGER ?? "",
|
||||
labelTrigger: process.env.LABEL_TRIGGER ?? "",
|
||||
|
||||
Reference in New Issue
Block a user