Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions apps/sim/lib/internal/github/execute-tool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ export const executeGitHubTool: InternalToolOperationHandler = async (request) =
try {
switch (request.toolId) {
case 'github_comment':
return executeToolOperationImplementation(executeGitHubCommentOperation, request)
return await executeToolOperationImplementation(executeGitHubCommentOperation, request)
case 'github_comment_v2':
return executeToolOperationImplementation(executeGitHubCommentV2Operation, request)
return await executeToolOperationImplementation(executeGitHubCommentV2Operation, request)
case 'github_latest_commit':
case 'github_latest_commit_v2': {
const parsed = inputSchema.safeParse(request.input)
Expand Down
25 changes: 20 additions & 5 deletions apps/sim/lib/internal/github/operations.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { createLogger } from '@sim/logger'
import { getErrorMessage } from '@sim/utils/errors'
import { isRecordLike } from '@sim/utils/object'
import {
secureFetchWithPinnedIP,
Expand All @@ -11,6 +12,7 @@ import {
} from '@/lib/core/utils/stream-limits'
import { GitHubOperationError } from '@/lib/internal/github/errors'
import { MAX_BUFFERED_TRANSFER_BYTES } from '@/lib/uploads/shared/types'
import { githubPathSegment, githubRepoPath } from '@/tools/github/request-path'
import { formatGitHubErrorMessage } from '@/tools/github/response-parsers'
import type {
CreateCommentParams,
Expand All @@ -19,6 +21,7 @@ import type {
} from '@/tools/github/types'
import { secureGitHubRequest } from '@/tools/github/utils.server'
import type { ToolResponse } from '@/tools/types'
import { safeUrlPathSegment } from '@/tools/url-path'

const logger = createLogger('GitHubLatestCommitOperation')
const MAX_COMMIT_RESPONSE_BYTES = 10 * 1024 * 1024
Expand Down Expand Up @@ -123,8 +126,20 @@ function githubHeaders(apiKey: string): Record<string, string> {
}
}

/** Builds a request path from caller input, reporting a rejected segment as a 400. */
function buildRequestPath(build: () => string): string {
try {
return build()
} catch (error) {
throw new GitHubOperationError(getErrorMessage(error, 'Invalid GitHub request path'), 400)
Comment thread
waleedlatif1 marked this conversation as resolved.
Resolved
}
}

function pullRequestUrl(params: CreateCommentParams): string {
return `${GITHUB_API_BASE}/repos/${params.owner}/${params.repo}/pulls/${params.pullNumber}`
return buildRequestPath(
() =>
`${GITHUB_API_BASE}/repos/${githubRepoPath(params.owner, params.repo)}/pulls/${githubPathSegment(params.pullNumber, 'pullNumber')}`
)
}

function isFileCommentRequest(params: CreateCommentParams): boolean {
Expand Down Expand Up @@ -400,10 +415,10 @@ export async function getGitHubLatestCommit(
context: GitHubOperationContext
): Promise<LatestCommitResponse> {
context.signal?.throwIfAborted()
const owner = encodeURIComponent(input.owner)
const repo = encodeURIComponent(input.repo)
const revision = encodeURIComponent(input.branch || 'HEAD')
const commitUrl = `https://api.github.com/repos/${owner}/${repo}/commits/${revision}`
const commitUrl = buildRequestPath(
() =>
`${GITHUB_API_BASE}/repos/${githubRepoPath(input.owner, input.repo)}/commits/${safeUrlPathSegment(input.branch || 'HEAD', 'branch', { allowSeparators: true })}`
)
const validation = await validateUrlWithDNS(commitUrl, 'commitUrl', 'configuredEndpoint')
context.signal?.throwIfAborted()
if (!validation.isValid) {
Expand Down
3 changes: 2 additions & 1 deletion apps/sim/tools/github/add_assignees.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { githubPathSegment, githubRepoPath } from '@/tools/github/request-path'
import type { AddAssigneesParams, IssueResponse } from '@/tools/github/types'
import { GITHUB_CREDENTIAL_OAUTH } from '@/tools/shared/saved-credentials'
import type { ToolConfig } from '@/tools/types'
Expand Down Expand Up @@ -44,7 +45,7 @@ export const addAssigneesTool: ToolConfig<AddAssigneesParams, IssueResponse> = {

request: {
url: (params) =>
`https://api.github.com/repos/${params.owner}/${params.repo}/issues/${params.issue_number}/assignees`,
`https://api.github.com/repos/${githubRepoPath(params.owner, params.repo)}/issues/${githubPathSegment(params.issue_number, 'issue_number')}/assignees`,
method: 'POST',
headers: (params) => ({
Accept: 'application/vnd.github.v3+json',
Expand Down
3 changes: 2 additions & 1 deletion apps/sim/tools/github/add_labels.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { githubPathSegment, githubRepoPath } from '@/tools/github/request-path'
import type { AddLabelsParams, LabelsResponse } from '@/tools/github/types'
import { GITHUB_CREDENTIAL_OAUTH } from '@/tools/shared/saved-credentials'
import type { ToolConfig } from '@/tools/types'
Expand Down Expand Up @@ -44,7 +45,7 @@ export const addLabelsTool: ToolConfig<AddLabelsParams, LabelsResponse> = {

request: {
url: (params) =>
`https://api.github.com/repos/${params.owner}/${params.repo}/issues/${params.issue_number}/labels`,
`https://api.github.com/repos/${githubRepoPath(params.owner, params.repo)}/issues/${githubPathSegment(params.issue_number, 'issue_number')}/labels`,
method: 'POST',
headers: (params) => ({
Accept: 'application/vnd.github.v3+json',
Expand Down
3 changes: 2 additions & 1 deletion apps/sim/tools/github/cancel_workflow_run.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { githubPathSegment, githubRepoPath } from '@/tools/github/request-path'
import type { CancelWorkflowRunParams, CancelWorkflowRunResponse } from '@/tools/github/types'
import { GITHUB_CREDENTIAL_OAUTH } from '@/tools/shared/saved-credentials'
import type { ToolConfig } from '@/tools/types'
Expand Down Expand Up @@ -40,7 +41,7 @@ export const cancelWorkflowRunTool: ToolConfig<CancelWorkflowRunParams, CancelWo

request: {
url: (params) =>
`https://api.github.com/repos/${params.owner}/${params.repo}/actions/runs/${params.run_id}/cancel`,
`https://api.github.com/repos/${githubRepoPath(params.owner, params.repo)}/actions/runs/${githubPathSegment(params.run_id, 'run_id')}/cancel`,
method: 'POST',
headers: (params) => ({
Accept: 'application/vnd.github+json',
Expand Down
3 changes: 2 additions & 1 deletion apps/sim/tools/github/close_issue.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { githubPathSegment, githubRepoPath } from '@/tools/github/request-path'
import type { CloseIssueParams, IssueResponse } from '@/tools/github/types'
import { ISSUE_OUTPUT_PROPERTIES, LABEL_OUTPUT, USER_OUTPUT } from '@/tools/github/types'
import { GITHUB_CREDENTIAL_OAUTH } from '@/tools/shared/saved-credentials'
Expand Down Expand Up @@ -45,7 +46,7 @@ export const closeIssueTool: ToolConfig<CloseIssueParams, IssueResponse> = {

request: {
url: (params) =>
`https://api.github.com/repos/${params.owner}/${params.repo}/issues/${params.issue_number}`,
`https://api.github.com/repos/${githubRepoPath(params.owner, params.repo)}/issues/${githubPathSegment(params.issue_number, 'issue_number')}`,
method: 'PATCH',
headers: (params) => ({
Accept: 'application/vnd.github.v3+json',
Expand Down
3 changes: 2 additions & 1 deletion apps/sim/tools/github/close_pr.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { githubPathSegment, githubRepoPath } from '@/tools/github/request-path'
import type { ClosePRParams, PRResponse } from '@/tools/github/types'
import { GITHUB_CREDENTIAL_OAUTH } from '@/tools/shared/saved-credentials'
import type { ToolConfig } from '@/tools/types'
Expand Down Expand Up @@ -38,7 +39,7 @@ export const closePRTool: ToolConfig<ClosePRParams, PRResponse> = {

request: {
url: (params) =>
`https://api.github.com/repos/${params.owner}/${params.repo}/pulls/${params.pullNumber}`,
`https://api.github.com/repos/${githubRepoPath(params.owner, params.repo)}/pulls/${githubPathSegment(params.pullNumber, 'pullNumber')}`,
method: 'PATCH',
headers: (params) => ({
Accept: 'application/vnd.github.v3+json',
Expand Down
3 changes: 2 additions & 1 deletion apps/sim/tools/github/compare_commits.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { githubRefPath, githubRepoPath } from '@/tools/github/request-path'
import {
COMMIT_DATA_OUTPUT,
COMMIT_FILE_OUTPUT_PROPERTIES,
Expand Down Expand Up @@ -105,7 +106,7 @@ export const compareCommitsTool: ToolConfig<CompareCommitsParams, CompareCommits
request: {
url: (params) => {
const url = new URL(
`https://api.github.com/repos/${params.owner}/${params.repo}/compare/${params.base}...${params.head}`
`https://api.github.com/repos/${githubRepoPath(params.owner, params.repo)}/compare/${githubRefPath(params.base, 'base')}...${githubRefPath(params.head, 'head')}`
)
if (params.per_page) url.searchParams.append('per_page', String(params.per_page))
if (params.page) url.searchParams.append('page', String(params.page))
Expand Down
4 changes: 3 additions & 1 deletion apps/sim/tools/github/create_branch.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { githubRepoPath } from '@/tools/github/request-path'
import type { CreateBranchParams, RefResponse } from '@/tools/github/types'
import { GIT_REF_OUTPUT_PROPERTIES } from '@/tools/github/types'
import { GITHUB_CREDENTIAL_OAUTH } from '@/tools/shared/saved-credentials'
Expand Down Expand Up @@ -45,7 +46,8 @@ export const createBranchTool: ToolConfig<CreateBranchParams, RefResponse> = {
},

request: {
url: (params) => `https://api.github.com/repos/${params.owner}/${params.repo}/git/refs`,
url: (params) =>
`https://api.github.com/repos/${githubRepoPath(params.owner, params.repo)}/git/refs`,
method: 'POST',
headers: (params) => ({
Accept: 'application/vnd.github+json',
Expand Down
3 changes: 2 additions & 1 deletion apps/sim/tools/github/create_comment_reaction.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { githubPathSegment, githubRepoPath } from '@/tools/github/request-path'
import { REACTION_OUTPUT_PROPERTIES, USER_OUTPUT } from '@/tools/github/types'
import { GITHUB_CREDENTIAL_OAUTH } from '@/tools/shared/saved-credentials'
import type { ToolConfig } from '@/tools/types'
Expand Down Expand Up @@ -69,7 +70,7 @@ export const createCommentReactionTool: ToolConfig<

request: {
url: (params) =>
`https://api.github.com/repos/${params.owner}/${params.repo}/issues/comments/${params.comment_id}/reactions`,
`https://api.github.com/repos/${githubRepoPath(params.owner, params.repo)}/issues/comments/${githubPathSegment(params.comment_id, 'comment_id')}/reactions`,
method: 'POST',
headers: (params) => ({
Accept: 'application/vnd.github.squirrel-girl-preview+json',
Expand Down
3 changes: 2 additions & 1 deletion apps/sim/tools/github/create_file.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { encodeContentPath } from '@/tools/github/content-path'
import { githubRepoPath } from '@/tools/github/request-path'
import type { CreateFileParams, FileOperationResponse } from '@/tools/github/types'
import { GITHUB_CREDENTIAL_OAUTH } from '@/tools/shared/saved-credentials'
import type { ToolConfig } from '@/tools/types'
Expand Down Expand Up @@ -58,7 +59,7 @@ export const createFileTool: ToolConfig<CreateFileParams, FileOperationResponse>

request: {
url: (params) =>
`https://api.github.com/repos/${params.owner}/${params.repo}/contents/${encodeContentPath(params.path)}`,
`https://api.github.com/repos/${githubRepoPath(params.owner, params.repo)}/contents/${encodeContentPath(params.path)}`,
method: 'PUT',
headers: (params) => ({
Accept: 'application/vnd.github+json',
Expand Down
4 changes: 3 additions & 1 deletion apps/sim/tools/github/create_issue.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { githubRepoPath } from '@/tools/github/request-path'
import type { CreateIssueParams, IssueResponse } from '@/tools/github/types'
import {
ISSUE_OUTPUT_PROPERTIES,
Expand Down Expand Up @@ -67,7 +68,8 @@ export const createIssueTool: ToolConfig<CreateIssueParams, IssueResponse> = {
},

request: {
url: (params) => `https://api.github.com/repos/${params.owner}/${params.repo}/issues`,
url: (params) =>
`https://api.github.com/repos/${githubRepoPath(params.owner, params.repo)}/issues`,
method: 'POST',
headers: (params) => ({
Accept: 'application/vnd.github.v3+json',
Expand Down
3 changes: 2 additions & 1 deletion apps/sim/tools/github/create_issue_reaction.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { githubPathSegment, githubRepoPath } from '@/tools/github/request-path'
import { REACTION_OUTPUT_PROPERTIES, USER_OUTPUT } from '@/tools/github/types'
import { GITHUB_CREDENTIAL_OAUTH } from '@/tools/shared/saved-credentials'
import type { ToolConfig } from '@/tools/types'
Expand Down Expand Up @@ -69,7 +70,7 @@ export const createIssueReactionTool: ToolConfig<

request: {
url: (params) =>
`https://api.github.com/repos/${params.owner}/${params.repo}/issues/${params.issue_number}/reactions`,
`https://api.github.com/repos/${githubRepoPath(params.owner, params.repo)}/issues/${githubPathSegment(params.issue_number, 'issue_number')}/reactions`,
method: 'POST',
headers: (params) => ({
Accept: 'application/vnd.github.squirrel-girl-preview+json',
Expand Down
4 changes: 3 additions & 1 deletion apps/sim/tools/github/create_milestone.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { githubRepoPath } from '@/tools/github/request-path'
import { MILESTONE_CREATOR_OUTPUT, MILESTONE_V2_OUTPUT_PROPERTIES } from '@/tools/github/types'
import { GITHUB_CREDENTIAL_OAUTH } from '@/tools/shared/saved-credentials'
import type { ToolConfig } from '@/tools/types'
Expand Down Expand Up @@ -85,7 +86,8 @@ export const createMilestoneTool: ToolConfig<CreateMilestoneParams, CreateMilest
},

request: {
url: (params) => `https://api.github.com/repos/${params.owner}/${params.repo}/milestones`,
url: (params) =>
`https://api.github.com/repos/${githubRepoPath(params.owner, params.repo)}/milestones`,
method: 'POST',
headers: (params) => ({
Accept: 'application/vnd.github.v3+json',
Expand Down
4 changes: 3 additions & 1 deletion apps/sim/tools/github/create_pr.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { githubRepoPath } from '@/tools/github/request-path'
import type { CreatePRParams, PRResponse } from '@/tools/github/types'
import { GITHUB_CREDENTIAL_OAUTH } from '@/tools/shared/saved-credentials'
import type { ToolConfig } from '@/tools/types'
Expand Down Expand Up @@ -61,7 +62,8 @@ export const createPRTool: ToolConfig<CreatePRParams, PRResponse> = {
},

request: {
url: (params) => `https://api.github.com/repos/${params.owner}/${params.repo}/pulls`,
url: (params) =>
`https://api.github.com/repos/${githubRepoPath(params.owner, params.repo)}/pulls`,
method: 'POST',
headers: (params) => ({
Accept: 'application/vnd.github.v3+json',
Expand Down
3 changes: 2 additions & 1 deletion apps/sim/tools/github/create_pr_review.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { isRecordLike } from '@sim/utils/object'
import { githubPathSegment, githubRepoPath } from '@/tools/github/request-path'
import {
nullableNonEmptyString,
optionalNonEmptyString,
Expand Down Expand Up @@ -161,7 +162,7 @@ export const createPRReviewTool: ToolConfig<CreatePRReviewParams, PRReviewRespon

request: {
url: (params) =>
`https://api.github.com/repos/${params.owner}/${params.repo}/pulls/${params.pullNumber}/reviews`,
`https://api.github.com/repos/${githubRepoPath(params.owner, params.repo)}/pulls/${githubPathSegment(params.pullNumber, 'pullNumber')}/reviews`,
method: 'POST',
headers: (params) => ({
Accept: 'application/vnd.github+json',
Expand Down
4 changes: 3 additions & 1 deletion apps/sim/tools/github/create_release.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { githubRepoPath } from '@/tools/github/request-path'
import type { CreateReleaseParams, ReleaseResponse } from '@/tools/github/types'
import {
RELEASE_ASSET_OUTPUT_PROPERTIES,
Expand Down Expand Up @@ -77,7 +78,8 @@ export const createReleaseTool: ToolConfig<CreateReleaseParams, ReleaseResponse>
},

request: {
url: (params) => `https://api.github.com/repos/${params.owner}/${params.repo}/releases`,
url: (params) =>
`https://api.github.com/repos/${githubRepoPath(params.owner, params.repo)}/releases`,
method: 'POST',
headers: (params) => ({
Accept: 'application/vnd.github+json',
Expand Down
3 changes: 2 additions & 1 deletion apps/sim/tools/github/delete_branch.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { githubRefPath, githubRepoPath } from '@/tools/github/request-path'
import type { DeleteBranchParams, DeleteBranchResponse } from '@/tools/github/types'
import { DELETE_BRANCH_OUTPUT_PROPERTIES } from '@/tools/github/types'
import { GITHUB_CREDENTIAL_OAUTH } from '@/tools/shared/saved-credentials'
Expand Down Expand Up @@ -40,7 +41,7 @@ export const deleteBranchTool: ToolConfig<DeleteBranchParams, DeleteBranchRespon

request: {
url: (params) =>
`https://api.github.com/repos/${params.owner}/${params.repo}/git/refs/heads/${params.branch}`,
`https://api.github.com/repos/${githubRepoPath(params.owner, params.repo)}/git/refs/heads/${githubRefPath(params.branch, 'branch')}`,
method: 'DELETE',
headers: (params) => ({
Accept: 'application/vnd.github+json',
Expand Down
3 changes: 2 additions & 1 deletion apps/sim/tools/github/delete_comment.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { githubPathSegment, githubRepoPath } from '@/tools/github/request-path'
import type { DeleteCommentParams, DeleteCommentResponse } from '@/tools/github/types'
import { GITHUB_CREDENTIAL_OAUTH } from '@/tools/shared/saved-credentials'
import type { ToolConfig } from '@/tools/types'
Expand Down Expand Up @@ -38,7 +39,7 @@ export const deleteCommentTool: ToolConfig<DeleteCommentParams, DeleteCommentRes

request: {
url: (params) =>
`https://api.github.com/repos/${params.owner}/${params.repo}/issues/comments/${params.comment_id}`,
`https://api.github.com/repos/${githubRepoPath(params.owner, params.repo)}/issues/comments/${githubPathSegment(params.comment_id, 'comment_id')}`,
method: 'DELETE',
headers: (params) => ({
Accept: 'application/vnd.github+json',
Expand Down
3 changes: 2 additions & 1 deletion apps/sim/tools/github/delete_comment_reaction.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { githubPathSegment, githubRepoPath } from '@/tools/github/request-path'
import { GITHUB_CREDENTIAL_OAUTH } from '@/tools/shared/saved-credentials'
import type { ToolConfig } from '@/tools/types'

Expand Down Expand Up @@ -65,7 +66,7 @@ export const deleteCommentReactionTool: ToolConfig<

request: {
url: (params) =>
`https://api.github.com/repos/${params.owner}/${params.repo}/issues/comments/${params.comment_id}/reactions/${params.reaction_id}`,
`https://api.github.com/repos/${githubRepoPath(params.owner, params.repo)}/issues/comments/${githubPathSegment(params.comment_id, 'comment_id')}/reactions/${githubPathSegment(params.reaction_id, 'reaction_id')}`,
method: 'DELETE',
headers: (params) => ({
Accept: 'application/vnd.github.squirrel-girl-preview+json',
Expand Down
3 changes: 2 additions & 1 deletion apps/sim/tools/github/delete_file.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { encodeContentPath } from '@/tools/github/content-path'
import { githubRepoPath } from '@/tools/github/request-path'
import type { DeleteFileParams, DeleteFileResponse } from '@/tools/github/types'
import { GITHUB_CREDENTIAL_OAUTH } from '@/tools/shared/saved-credentials'
import type { ToolConfig } from '@/tools/types'
Expand Down Expand Up @@ -58,7 +59,7 @@ export const deleteFileTool: ToolConfig<DeleteFileParams, DeleteFileResponse> =

request: {
url: (params) =>
`https://api.github.com/repos/${params.owner}/${params.repo}/contents/${encodeContentPath(params.path)}`,
`https://api.github.com/repos/${githubRepoPath(params.owner, params.repo)}/contents/${encodeContentPath(params.path)}`,
method: 'DELETE',
headers: (params) => ({
Accept: 'application/vnd.github+json',
Expand Down
3 changes: 2 additions & 1 deletion apps/sim/tools/github/delete_gist.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { githubPathSegment } from '@/tools/github/request-path'
import { GITHUB_CREDENTIAL_OAUTH } from '@/tools/shared/saved-credentials'
import type { ToolConfig } from '@/tools/types'

Expand Down Expand Up @@ -40,7 +41,7 @@ export const deleteGistTool: ToolConfig<DeleteGistParams, DeleteGistResponse> =
},

request: {
url: (params) => `https://api.github.com/gists/${params.gist_id?.trim()}`,
url: (params) => `https://api.github.com/gists/${githubPathSegment(params.gist_id, 'gist_id')}`,
method: 'DELETE',
headers: (params) => ({
Accept: 'application/vnd.github.v3+json',
Expand Down
3 changes: 2 additions & 1 deletion apps/sim/tools/github/delete_issue_reaction.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { githubPathSegment, githubRepoPath } from '@/tools/github/request-path'
import { GITHUB_CREDENTIAL_OAUTH } from '@/tools/shared/saved-credentials'
import type { ToolConfig } from '@/tools/types'

Expand Down Expand Up @@ -65,7 +66,7 @@ export const deleteIssueReactionTool: ToolConfig<

request: {
url: (params) =>
`https://api.github.com/repos/${params.owner}/${params.repo}/issues/${params.issue_number}/reactions/${params.reaction_id}`,
`https://api.github.com/repos/${githubRepoPath(params.owner, params.repo)}/issues/${githubPathSegment(params.issue_number, 'issue_number')}/reactions/${githubPathSegment(params.reaction_id, 'reaction_id')}`,
method: 'DELETE',
headers: (params) => ({
Accept: 'application/vnd.github.squirrel-girl-preview+json',
Expand Down
3 changes: 2 additions & 1 deletion apps/sim/tools/github/delete_milestone.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { githubPathSegment, githubRepoPath } from '@/tools/github/request-path'
import { GITHUB_CREDENTIAL_OAUTH } from '@/tools/shared/saved-credentials'
import type { ToolConfig } from '@/tools/types'

Expand Down Expand Up @@ -55,7 +56,7 @@ export const deleteMilestoneTool: ToolConfig<DeleteMilestoneParams, DeleteMilest

request: {
url: (params) =>
`https://api.github.com/repos/${params.owner}/${params.repo}/milestones/${params.milestone_number}`,
`https://api.github.com/repos/${githubRepoPath(params.owner, params.repo)}/milestones/${githubPathSegment(params.milestone_number, 'milestone_number')}`,
method: 'DELETE',
headers: (params) => ({
Accept: 'application/vnd.github.v3+json',
Expand Down
Loading
Loading