File tree Expand file tree Collapse file tree
Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tools/GitHub Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -160,8 +160,20 @@ function Invoke-ExecCommunityRepo {
160160 $Path = $Request.Body.Path
161161 $FullName = $Request.Body.FullName
162162 $Branch = $Request.Body.Branch
163- $Template = Get-GitHubFileContents - FullName $FullName - Path $Path - Branch $Branch
164- Import-CommunityTemplate - Template $Template.content - SHA $Template.sha
163+ try {
164+ $Template = Get-GitHubFileContents - FullName $FullName - Path $Path - Branch $Branch
165+ $Content = $Template.content | ConvertFrom-Json
166+ Import-CommunityTemplate - Template $Content - SHA $Template.sha
167+ $Results = @ {
168+ resultText = ' Template imported'
169+ state = ' success'
170+ }
171+ } catch {
172+ $Results = @ {
173+ resultText = " Error importing template: $ ( $_.Exception.Message ) "
174+ state = ' error'
175+ }
176+ }
165177 }
166178 default {
167179 $Results = @ {
You can’t perform that action at this time.
0 commit comments