You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Write-Error"Failed to find tsp-location.yaml in '$sdkProjectFolder', please make sure to provide CommitHash and RepoUrl parameters along with the local path of tspconfig.yaml in order to create tsp-location.yaml."
172
-
exit1
172
+
# try to create tsp-location.yaml using HEAD commit of the local spec repo
173
+
Write-Warning"Failed to find tsp-location.yaml in '$sdkProjectFolder'. Trying to create tsp-location.yaml using HEAD commit of the local spec repo then proceed the sdk generation based upon local typespecs at $specRepoRoot. Alternatively, please make sure to provide CommitHash and RepoUrl parameters when running this script."
174
+
# set default repo to Azure/azure-rest-api-specs
175
+
$repo="Azure/azure-rest-api-specs"
176
+
try {
177
+
Push-Location$specRepoRoot
178
+
$CommitHash=$(git rev-parse HEAD)
179
+
$gitOriginUrl= (git remote get-url origin)
180
+
if ($gitOriginUrl-and$gitOriginUrl-match'(.*)?github.com:(?<repo>[^/]*/azure-rest-api-specs(-pr)?)(.git)?') {
181
+
$repo=$Matches["repo"]
182
+
Write-Host"Found git origin repo: $repo"
183
+
}
184
+
else {
185
+
Write-Warning"Failed to find git origin repo of the local spec repo at specRepoRoot: $specRepoRoot. Using default repo: $repo"
186
+
}
187
+
}
188
+
catch {
189
+
Write-Error"Failed to get HEAD commit or remote origin of the local spec repo at specRepoRoot: $specRepoRoot."
0 commit comments