Fix job id

This commit is contained in:
Mark Wylde
2025-05-31 09:26:06 +01:00
parent e5b2574f8c
commit 5c040da573
5 changed files with 36 additions and 24 deletions

View File

@@ -68,21 +68,21 @@ jobs:
## Inputs ## Inputs
| Input | Description | Required | Default | | Input | Description | Required | Default |
| --------------------- | -------------------------------------------------------------------------------------------------------------------- | -------- | ---------- | | --------------------- | ------------------------------------------------------------------------------------------------------------------- | -------- | --------- |
| `anthropic_api_key` | Anthropic API key (required for direct API, not needed for Bedrock/Vertex) | No\* | - | | `anthropic_api_key` | Anthropic API key (required for direct API, not needed for Bedrock/Vertex) | No\* | - |
| `direct_prompt` | Direct prompt for Claude to execute automatically without needing a trigger (for automated workflows) | No | - | | `direct_prompt` | Direct prompt for Claude to execute automatically without needing a trigger (for automated workflows) | No | - |
| `timeout_minutes` | Timeout in minutes for execution | No | `30` | | `timeout_minutes` | Timeout in minutes for execution | No | `30` |
| `gitea_token` | Gitea token for Claude to operate with. **Only include this if you're connecting a custom GitHub app of your own!** | No | - | | `gitea_token` | Gitea token for Claude to operate with. **Only include this if you're connecting a custom GitHub app of your own!** | No | - |
| `model` | Model to use (provider-specific format required for Bedrock/Vertex) | No | - | | `model` | Model to use (provider-specific format required for Bedrock/Vertex) | No | - |
| `anthropic_model` | **DEPRECATED**: Use `model` instead. Kept for backward compatibility. | No | - | | `anthropic_model` | **DEPRECATED**: Use `model` instead. Kept for backward compatibility. | No | - |
| `use_bedrock` | Use Amazon Bedrock with OIDC authentication instead of direct Anthropic API | No | `false` | | `use_bedrock` | Use Amazon Bedrock with OIDC authentication instead of direct Anthropic API | No | `false` |
| `use_vertex` | Use Google Vertex AI with OIDC authentication instead of direct Anthropic API | No | `false` | | `use_vertex` | Use Google Vertex AI with OIDC authentication instead of direct Anthropic API | No | `false` |
| `allowed_tools` | Additional tools for Claude to use (the base GitHub tools will always be included) | No | "" | | `allowed_tools` | Additional tools for Claude to use (the base GitHub tools will always be included) | No | "" |
| `disallowed_tools` | Tools that Claude should never use | No | "" | | `disallowed_tools` | Tools that Claude should never use | No | "" |
| `custom_instructions` | Additional custom instructions to include in the prompt for Claude | No | "" | | `custom_instructions` | Additional custom instructions to include in the prompt for Claude | No | "" |
| `assignee_trigger` | The assignee username that triggers the action (e.g. @claude). Only used for issue assignment | No | - | | `assignee_trigger` | The assignee username that triggers the action (e.g. @claude). Only used for issue assignment | No | - |
| `trigger_phrase` | The trigger phrase to look for in comments, issue/PR bodies, and issue titles | No | `@claude` | | `trigger_phrase` | The trigger phrase to look for in comments, issue/PR bodies, and issue titles | No | `@claude` |
\*Required when using direct Anthropic API (default and when not using Bedrock or Vertex) \*Required when using direct Anthropic API (default and when not using Bedrock or Vertex)

View File

@@ -32,7 +32,7 @@ async function run() {
const client = createClient(githubToken); const client = createClient(githubToken);
const serverUrl = GITEA_SERVER_URL; const serverUrl = GITEA_SERVER_URL;
const jobUrl = `${serverUrl}/${owner}/${repo}/actions/runs/${process.env.GITHUB_RUN_ID}`; const jobUrl = `${serverUrl}/${owner}/${repo}/actions/runs/${process.env.GITHUB_RUN_NUMBER}`;
let comment; let comment;
let isPRReviewComment = false; let isPRReviewComment = false;

View File

@@ -40,7 +40,7 @@ export function parseGitHubContext(): ParsedGitHubContext {
const context = github.context; const context = github.context;
const commonFields = { const commonFields = {
runId: process.env.GITHUB_RUN_ID!, runId: process.env.GITHUB_RUN_NUMBER!,
eventName: context.eventName, eventName: context.eventName,
eventAction: context.payload.action, eventAction: context.payload.action,
repository: { repository: {

View File

@@ -136,11 +136,15 @@ server.tool(
create_if_missing: z create_if_missing: z
.boolean() .boolean()
.optional() .optional()
.describe("Create branch if it doesn't exist locally (defaults to false)"), .describe(
"Create branch if it doesn't exist locally (defaults to false)",
),
fetch_remote: z fetch_remote: z
.boolean() .boolean()
.optional() .optional()
.describe("Fetch from remote if branch doesn't exist locally (defaults to true)"), .describe(
"Fetch from remote if branch doesn't exist locally (defaults to true)",
),
}, },
async ({ branch_name, create_if_missing = false, fetch_remote = true }) => { async ({ branch_name, create_if_missing = false, fetch_remote = true }) => {
try { try {
@@ -150,17 +154,23 @@ server.tool(
runGitCommand(`git rev-parse --verify ${branch_name}`); runGitCommand(`git rev-parse --verify ${branch_name}`);
branchExists = true; branchExists = true;
} catch (error) { } catch (error) {
console.log(`[LOCAL-GIT-MCP] Branch ${branch_name} doesn't exist locally`); console.log(
`[LOCAL-GIT-MCP] Branch ${branch_name} doesn't exist locally`,
);
} }
// If branch doesn't exist locally, try to fetch from remote // If branch doesn't exist locally, try to fetch from remote
if (!branchExists && fetch_remote) { if (!branchExists && fetch_remote) {
try { try {
console.log(`[LOCAL-GIT-MCP] Attempting to fetch ${branch_name} from remote`); console.log(
`[LOCAL-GIT-MCP] Attempting to fetch ${branch_name} from remote`,
);
runGitCommand(`git fetch origin ${branch_name}:${branch_name}`); runGitCommand(`git fetch origin ${branch_name}:${branch_name}`);
branchExists = true; branchExists = true;
} catch (error) { } catch (error) {
console.log(`[LOCAL-GIT-MCP] Branch ${branch_name} doesn't exist on remote`); console.log(
`[LOCAL-GIT-MCP] Branch ${branch_name} doesn't exist on remote`,
);
} }
} }
@@ -180,7 +190,9 @@ server.tool(
// If branch doesn't exist and we can't/won't create it, throw error // If branch doesn't exist and we can't/won't create it, throw error
if (!branchExists) { if (!branchExists) {
throw new Error(`Branch '${branch_name}' does not exist locally or on remote. Use create_if_missing=true to create it.`); throw new Error(
`Branch '${branch_name}' does not exist locally or on remote. Use create_if_missing=true to create it.`,
);
} }
// Checkout the existing branch // Checkout the existing branch