Skip to content

Commit 21b0cba

Browse files
apim (#27)
1 parent 5a52f33 commit 21b0cba

File tree

1 file changed

+18
-6
lines changed

1 file changed

+18
-6
lines changed

.github/workflows/update-apim-api.yaml

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff 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

0 commit comments

Comments
 (0)