import { DeploymentsTreeItem , editScmType } from "vscode-azureappservice" ; import { GenericTreeItem , IActionContext } from "vscode-azureextensionui" ; import { ScmType } from "../../constants" ; import { ext } from "../../extensionVariables" ; import { ProductionSlotTreeItem } from "../../tree/ProductionSlotTreeItem" ; import { SlotTreeItemBase } from "../../tree/SlotTreeItemBase" ; export async function connectToGitHub ( context , target ? ) { let node ; if ( ! target ) { node = await ext . tree . showTreeItemPicker < ProductionSlotTreeItem > ( ProductionSlotTreeItem . contextValue , context ) ; } else { node = < DeploymentsTreeItem > target . parent ; } if ( node ?. parent instanceof SlotTreeItemBase ) { await editScmType ( context , node . site , node . subscription , ScmType . GitHub ) ; } else { throw Error ( 'Internal error: Action not supported.' ) ; } if ( node instanceof ProductionSlotTreeItem ) { if ( node . deploymentsNode ) { await node . deploymentsNode . refresh ( context ) ; } } else { await node . parent ?. refresh ( context ) ; } }