Skip to content

Commit b67e3bb

Browse files
committed
Fix newline preservation in work item description capture
Use file-based capture (pipe to file) instead of command substitution to preserve trailing newlines. Step 3 now uses jq --rawfile to read back the description byte-for-byte.
1 parent 8e98f32 commit b67e3bb

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,13 @@ Some work items reject a direct type switch unless a valid value is provided. Us
4343
### Step 1: Capture current description
4444

4545
```bash
46-
desc=$(az boards work-item show --id <id> | jq -r '.fields["System.Description"] // ""')
46+
az boards work-item show --id <id> | jq -r '.fields["System.Description"] // ""' > ./desc-backup.txt
4747
```
4848

49+
> **NOTE**: Writing to a file preserves all characters including trailing newlines.
50+
> Command substitution (`$(...)`) silently strips trailing newlines, which would
51+
> corrupt multi-line Markdown content.
52+
4953
### Step 2: Force markdown type with temporary empty value
5054

5155
```bash
@@ -69,7 +73,7 @@ az rest \
6973
```bash
7074
PATCH_STEP2_FILE="${PATCH_STEP2_FILE:-./patch-step2.json}"
7175

72-
jq -n --arg d "$desc" '[
76+
jq -n --rawfile d ./desc-backup.txt '[
7377
{"op":"replace","path":"/fields/System.Description","value":$d}
7478
]' >"$PATCH_STEP2_FILE"
7579

0 commit comments

Comments
 (0)