Skip to content

Commit 9a70446

Browse files
authored
In the getDeploymentProcess tool, ensure processId is set if not provided (#34)
1 parent 0b678ee commit 9a70446

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,3 +137,4 @@ dist
137137
# Vite logs files
138138
vite.config.js.timestamp-*
139139
vite.config.ts.timestamp-*
140+
.idea

src/tools/getDeploymentProcess.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,20 @@ This tool retrieves a deployment process by its ID. Each project has a deploymen
2424
readOnlyHint: true,
2525
},
2626
async ({ spaceName, processId, projectId, branchName, includeDetails = false }) => {
27+
28+
if (!processId && !projectId) {
29+
throw new Error("Either processId or projectId must be provided.");
30+
}
31+
2732
const configuration = getClientConfigurationFromEnvironment();
2833
const client = await Client.create(configuration);
2934
const spaceId = await resolveSpaceId(client, spaceName);
3035
const projectRepository = projectId ? new ProjectRepository(client, spaceName) : null;
3136
const project = projectRepository && projectId ? await projectRepository.get(projectId) : null;
3237

33-
if (!processId && !projectId) {
34-
throw new Error("Either processId or projectId must be provided.");
38+
// If we were not supplied a processId, we assume we are retrieving the process for the specified project.
39+
if (!processId) {
40+
processId = project?.DeploymentProcessId;
3541
}
3642

3743
if (project?.IsVersionControlled && !branchName) {

0 commit comments

Comments
 (0)