feat: 开发者面板页面git工具支持推送远程仓库
This commit is contained in:
@@ -12,6 +12,7 @@ import {
|
||||
resetToCommit,
|
||||
getCurrentBranch,
|
||||
hasUncommittedChanges,
|
||||
pushToRemote,
|
||||
} from '@/server/utils/git-helper'
|
||||
|
||||
|
||||
@@ -224,6 +225,25 @@ export const devPanelRouter = createTRPCRouter({
|
||||
})
|
||||
}
|
||||
}),
|
||||
|
||||
/**
|
||||
* 推送分支到远程仓库
|
||||
*/
|
||||
pushToRemote: permissionRequiredProcedure('SUPER_ADMIN_ONLY')
|
||||
.input(z.object({
|
||||
branchName: z.string().min(1, '分支名称不能为空'),
|
||||
}))
|
||||
.mutation(async ({ input }) => {
|
||||
try {
|
||||
await pushToRemote(input.branchName)
|
||||
return { success: true, message: `已推送分支 ${input.branchName} 到远程仓库` }
|
||||
} catch (error: any) {
|
||||
throw new TRPCError({
|
||||
code: 'INTERNAL_SERVER_ERROR',
|
||||
message: `推送失败: ${error.message}`,
|
||||
})
|
||||
}
|
||||
}),
|
||||
})
|
||||
|
||||
export type DevPanelRouter = typeof devPanelRouter
|
||||
Reference in New Issue
Block a user