File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -121,9 +121,14 @@ Function Move-Generation2Master {
121121
122122 # Region generate-info.json Here have a issue that user may not use latest version to generate the code.
123123 $generateInfo = [ordered ]@ {}
124- $repo = " https://github.com/Azure/azure-rest-api-specs"
125- $commit = git ls- remote $repo HEAD
126- $generateInfo.Add (" swagger_commit" , $commit.Substring (0 , 40 ))
124+ $content = Get-Content README.md
125+ $commitId = [System.Text.RegularExpressions.Regex ]::New(" (?i)\bbranch\b:[ \t]*([0-9a-zA-Z]+)" ).Matches($content ) | % {$_.groups [1 ].Value}
126+ if ($commitId -eq $null -or $commitId -eq " main" )
127+ {
128+ $repo = " https://github.com/Azure/azure-rest-api-specs"
129+ $commitId = git ls- remote $repo HEAD
130+ }
131+ $generateInfo.Add (" swagger_commit" , $commitId.Substring (0 , 40 ))
127132 $generateInfo.Add (" node" , (node -- version))
128133 $autorest_info = (npm ls - g @autorest / autorest).Split(' @' )
129134 $generateInfo.Add (" autorest" , ($autorest_info [$autorest_info.count - 2 ]).trim())
You can’t perform that action at this time.
0 commit comments