Skip to content

Commit 9581de8

Browse files
committed
docs: address PR 4253 review feedback in ADO markdown guide
1 parent 406d584 commit 9581de8

1 file changed

Lines changed: 11 additions & 5 deletions

File tree

.github/instructions/ado-work-items-markdown.instructions.md

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ az rest \
3434
--url "https://dev.azure.com/<org>/_apis/projects?api-version=7.1-preview.4"
3535
```
3636

37+
Note: API versions can differ by endpoint. The examples below use `7.1-preview.3` for work item PATCH calls, while this auth check uses `7.1-preview.4`.
38+
3739
## Safe Update Pattern (Prevents Type/Value Errors)
3840

3941
Some work items reject a direct type switch unless a valid value is provided. Use this two-step process:
@@ -47,32 +49,36 @@ desc=$(az boards work-item show --id <id> | jq -r '.fields["System.Description"]
4749
### Step 2: Force markdown type with temporary empty value
4850

4951
```bash
52+
PATCH_STEP1_FILE="${PATCH_STEP1_FILE:-./patch-step1.json}"
53+
5054
jq -n '[
5155
{"op":"replace","path":"/fields/System.Description","value":""},
5256
{"op":"replace","path":"/multilineFieldsFormat/System.Description","value":"markdown"}
53-
]' >/tmp/patch-step1.json
57+
]' >"$PATCH_STEP1_FILE"
5458

5559
az rest \
5660
--method PATCH \
5761
--resource 499b84ac-1321-427f-aa17-267ca6975798 \
5862
--url "https://dev.azure.com/<org>/<project>/_apis/wit/workitems/<id>?api-version=7.1-preview.3" \
5963
--headers "Content-Type=application/json-patch+json" \
60-
--body @/tmp/patch-step1.json
64+
--body @"$PATCH_STEP1_FILE"
6165
```
6266

6367
### Step 3: Restore exact Markdown text
6468

6569
```bash
70+
PATCH_STEP2_FILE="${PATCH_STEP2_FILE:-./patch-step2.json}"
71+
6672
jq -n --arg d "$desc" '[
6773
{"op":"replace","path":"/fields/System.Description","value":$d}
68-
]' >/tmp/patch-step2.json
74+
]' >"$PATCH_STEP2_FILE"
6975

7076
az rest \
7177
--method PATCH \
7278
--resource 499b84ac-1321-427f-aa17-267ca6975798 \
7379
--url "https://dev.azure.com/<org>/<project>/_apis/wit/workitems/<id>?api-version=7.1-preview.3" \
7480
--headers "Content-Type=application/json-patch+json" \
75-
--body @/tmp/patch-step2.json
81+
--body @"$PATCH_STEP2_FILE"
7682
```
7783

7884
## Newline Integrity Checks
@@ -107,7 +113,7 @@ Use this after bulk updates:
107113
```bash
108114
python3 - <<'PY'
109115
import json, subprocess
110-
ids = [44787, 44794] # replace with your target IDs
116+
ids = [12345, 12346] # replace with your target IDs
111117
bad = []
112118
for i in ids:
113119
out = subprocess.check_output(["az", "boards", "work-item", "show", "--id", str(i)], text=True)

0 commit comments

Comments
 (0)