6bf8bebf51
CI / Test and Build (push) Failing after 1s
CI / Migrate Dev DB (push) Has been skipped
CI / Migrate DB (push) Has been skipped
CodeQL / Analyze actions (push) Has been cancelled
CodeQL / Analyze javascript-typescript (push) Has been cancelled
CI / Detect Version (push) Has been cancelled
CI / Detect Desktop Changes (push) Has been cancelled
CI / Build AMD64 (blacksmith-2vcpu-ubuntu-2404, ./docker/cron.Dockerfile, ubuntu-latest, ghcr.io/simstudioai/cron) (push) Has been cancelled
CI / Build AMD64 (blacksmith-2vcpu-ubuntu-2404, ./docker/db.Dockerfile, ECR_MIGRATIONS, ubuntu-latest, ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Build AMD64 (blacksmith-4vcpu-ubuntu-2404, ./docker/pii.Dockerfile, ECR_PII, ubuntu-latest, ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Build AMD64 (blacksmith-4vcpu-ubuntu-2404, ./docker/realtime.Dockerfile, ECR_REALTIME, ubuntu-latest, ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Build AMD64 (blacksmith-8vcpu-ubuntu-2404, ./docker/app.Dockerfile, ECR_APP, linux-x64-8-core, ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (blacksmith-4vcpu-ubuntu-2404-arm, ./docker/cron.Dockerfile, ubuntu-24.04-arm, ghcr.io/simstudioai/cron) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (blacksmith-4vcpu-ubuntu-2404-arm, ./docker/db.Dockerfile, ubuntu-24.04-arm, ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (blacksmith-4vcpu-ubuntu-2404-arm, ./docker/pii.Dockerfile, ubuntu-24.04-arm, ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (blacksmith-4vcpu-ubuntu-2404-arm, ./docker/realtime.Dockerfile, ubuntu-24.04-arm, ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (blacksmith-8vcpu-ubuntu-2404-arm, ./docker/app.Dockerfile, linux-arm64-8-core, ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Check Docs Changes (push) Has been cancelled
Publish CLI Package / publish-npm (push) Has been cancelled
Publish Python SDK / publish-pypi (push) Has been cancelled
CI / Deploy Trigger.dev (Dev) (push) Has been cancelled
Helm Chart / Lint, test, and validate chart (push) Has been cancelled
Helm Chart / Chart version bumped (push) Has been cancelled
Publish TypeScript SDK / publish-npm (push) Has been cancelled
CI / Build Dev ECR (blacksmith-8vcpu-ubuntu-2404, ./docker/app.Dockerfile, ECR_APP, linux-x64-8-core) (push) Has been cancelled
CI / Promote Images (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/cron) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Build Dev ECR (blacksmith-2vcpu-ubuntu-2404, ./docker/db.Dockerfile, ECR_MIGRATIONS, ubuntu-latest) (push) Has been cancelled
CI / Build Dev ECR (blacksmith-4vcpu-ubuntu-2404, ./docker/pii.Dockerfile, ECR_PII, ubuntu-latest) (push) Has been cancelled
CI / Build Dev ECR (blacksmith-4vcpu-ubuntu-2404, ./docker/realtime.Dockerfile, ECR_REALTIME, ubuntu-latest) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Process Docs (push) Has been cancelled
CI / Create GitHub Release (push) Has been cancelled
CI / Check Desktop Signing Secrets (push) Has been cancelled
CI / Desktop Release (push) Has been cancelled
CI / Create Desktop Prerelease (push) Has been cancelled
CI / Desktop Prerelease Build (push) Has been cancelled
CI / Publish Desktop Prerelease (push) Has been cancelled
CI / Prune Desktop Prereleases (push) Has been cancelled
Helm Chart / Install on kind and run helm test (push) Has been cancelled
142 lines
4.3 KiB
TypeScript
142 lines
4.3 KiB
TypeScript
import type { ClosePRParams, PRResponse } from '@/tools/github/types'
|
|
import type { ToolConfig } from '@/tools/types'
|
|
|
|
export const closePRTool: ToolConfig<ClosePRParams, PRResponse> = {
|
|
id: 'github_close_pr',
|
|
name: 'GitHub Close Pull Request',
|
|
description: 'Close a pull request in a GitHub repository',
|
|
version: '1.0.0',
|
|
|
|
params: {
|
|
owner: {
|
|
type: 'string',
|
|
required: true,
|
|
visibility: 'user-or-llm',
|
|
description: 'Repository owner',
|
|
},
|
|
repo: {
|
|
type: 'string',
|
|
required: true,
|
|
visibility: 'user-or-llm',
|
|
description: 'Repository name',
|
|
},
|
|
pullNumber: {
|
|
type: 'number',
|
|
required: true,
|
|
visibility: 'user-or-llm',
|
|
description: 'Pull request number',
|
|
},
|
|
apiKey: {
|
|
type: 'string',
|
|
required: true,
|
|
visibility: 'user-only',
|
|
description: 'GitHub API token',
|
|
},
|
|
},
|
|
|
|
request: {
|
|
url: (params) =>
|
|
`https://api.github.com/repos/${params.owner}/${params.repo}/pulls/${params.pullNumber}`,
|
|
method: 'PATCH',
|
|
headers: (params) => ({
|
|
Accept: 'application/vnd.github.v3+json',
|
|
Authorization: `Bearer ${params.apiKey}`,
|
|
'X-GitHub-Api-Version': '2022-11-28',
|
|
}),
|
|
body: () => ({
|
|
state: 'closed',
|
|
}),
|
|
},
|
|
|
|
transformResponse: async (response) => {
|
|
const pr = await response.json()
|
|
|
|
const content = `PR #${pr.number} closed: "${pr.title}"
|
|
URL: ${pr.html_url}`
|
|
|
|
return {
|
|
success: true,
|
|
output: {
|
|
content,
|
|
metadata: {
|
|
number: pr.number,
|
|
title: pr.title,
|
|
state: pr.state,
|
|
html_url: pr.html_url,
|
|
merged: pr.merged,
|
|
draft: pr.draft,
|
|
created_at: pr.created_at,
|
|
updated_at: pr.updated_at,
|
|
},
|
|
},
|
|
}
|
|
},
|
|
|
|
outputs: {
|
|
content: { type: 'string', description: 'Human-readable PR close confirmation' },
|
|
metadata: {
|
|
type: 'object',
|
|
description: 'Closed pull request metadata',
|
|
properties: {
|
|
number: { type: 'number', description: 'Pull request number' },
|
|
title: { type: 'string', description: 'PR title' },
|
|
state: { type: 'string', description: 'PR state (should be closed)' },
|
|
html_url: { type: 'string', description: 'GitHub web URL' },
|
|
merged: { type: 'boolean', description: 'Whether PR is merged' },
|
|
draft: { type: 'boolean', description: 'Whether PR is draft' },
|
|
created_at: { type: 'string', description: 'Creation timestamp' },
|
|
updated_at: { type: 'string', description: 'Last update timestamp' },
|
|
},
|
|
},
|
|
},
|
|
}
|
|
|
|
export const closePRV2Tool: ToolConfig<ClosePRParams, any> = {
|
|
id: 'github_close_pr_v2',
|
|
name: closePRTool.name,
|
|
description: closePRTool.description,
|
|
version: '2.0.0',
|
|
params: closePRTool.params,
|
|
request: closePRTool.request,
|
|
|
|
transformResponse: async (response: Response) => {
|
|
const pr = await response.json()
|
|
return {
|
|
success: true,
|
|
output: {
|
|
id: pr.id,
|
|
number: pr.number,
|
|
title: pr.title,
|
|
state: pr.state,
|
|
html_url: pr.html_url,
|
|
body: pr.body ?? null,
|
|
user: pr.user,
|
|
head: pr.head,
|
|
base: pr.base,
|
|
draft: pr.draft,
|
|
merged: pr.merged,
|
|
closed_at: pr.closed_at ?? null,
|
|
created_at: pr.created_at,
|
|
updated_at: pr.updated_at,
|
|
},
|
|
}
|
|
},
|
|
|
|
outputs: {
|
|
id: { type: 'number', description: 'PR ID' },
|
|
number: { type: 'number', description: 'PR number' },
|
|
title: { type: 'string', description: 'PR title' },
|
|
state: { type: 'string', description: 'PR state (closed)' },
|
|
html_url: { type: 'string', description: 'GitHub web URL' },
|
|
body: { type: 'string', description: 'PR description', optional: true },
|
|
user: { type: 'json', description: 'User who created the PR' },
|
|
head: { type: 'json', description: 'Head branch info' },
|
|
base: { type: 'json', description: 'Base branch info' },
|
|
draft: { type: 'boolean', description: 'Whether PR is a draft' },
|
|
merged: { type: 'boolean', description: 'Whether PR is merged' },
|
|
closed_at: { type: 'string', description: 'Close timestamp', optional: true },
|
|
created_at: { type: 'string', description: 'Creation timestamp' },
|
|
updated_at: { type: 'string', description: 'Last update timestamp' },
|
|
},
|
|
}
|