File tree Expand file tree Collapse file tree 1 file changed +18
-6
lines changed Expand file tree Collapse file tree 1 file changed +18
-6
lines changed Original file line number Diff line number Diff line change @@ -49,16 +49,28 @@ jobs:
4949 shell : pwsh
5050 run : |
5151 try {
52- $current = az apim api show `
52+ # fetch description
53+ $desc = az apim api show `
5354 -g ${{ vars.APIM_RG }} `
5455 --service-name ${{ vars.APIM_SERVICE_NAME }} `
5556 --api-id ${{ inputs.api_path }}-api `
56- --query "apiRevision" -o tsv
57- # if current revision > 1, increment; otherwise keep it at 1
58- if ([int]$current -gt 1) {
59- $rev = [int]$current + 1
60- } else {
57+ --query "description" -o tsv
58+
59+ if ([string]::IsNullOrEmpty($desc) -or $desc -eq "null") {
60+ # no existing description → first revision
6161 $rev = 1
62+ } else {
63+ # has description → bump previous revision
64+ $current = az apim api show `
65+ -g ${{ vars.APIM_RG }} `
66+ --service-name ${{ vars.APIM_SERVICE_NAME }} `
67+ --api-id ${{ inputs.api_path }}-api `
68+ --query "apiRevision" -o tsv
69+ if ($current -match '^\d+$') {
70+ $rev = [int]$current + 1
71+ } else {
72+ $rev = 1
73+ }
6274 }
6375 } catch {
6476 $rev = 1
You can’t perform that action at this time.
0 commit comments