diff --git a/components/dashboard/src/start/StartWorkspace.tsx b/components/dashboard/src/start/StartWorkspace.tsx index 3397d789558c3c..889d0dceb0a710 100644 --- a/components/dashboard/src/start/StartWorkspace.tsx +++ b/components/dashboard/src/start/StartWorkspace.tsx @@ -149,7 +149,7 @@ export default class StartWorkspace extends React.Component { + if (!CommitContext.is(context)) { + throw new Error("can only start incremental prebuilds on a commit context") + } + + const host = new URL(context.repository.cloneUrl).hostname; + const hostContext = this.hostContextProvider.get(host); + const maxDepth = this.env.incrementalPrebuildsCommitHistory; + const result: StartPrebuildContext = { + title: `Prebuild of "${context.title}"`, + actual: context, + commitHistory: await (hostContext?.contextParser?.fetchCommitHistory({}, user, context.repository.cloneUrl, context.revision, maxDepth) || []) + }; + return result; + } + +} \ No newline at end of file