Skip to content

Commit

Permalink
Merge pull request #1 from williamfigtree/patch-1
Browse files Browse the repository at this point in the history
Fix can't migrate title with double quotes
  • Loading branch information
joshjohanning authored Mar 22, 2022
2 parents 58e482e + 26028d0 commit 395e63e
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion ado_workitems_to_github_issues.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@ ForEach($workitem in $query) {
$details_json = az boards work-item show --id $workitem.id --output json
$details = $details_json | ConvertFrom-Json

# double quotes in the title must be escaped with \ to be passed to gh cli
# workaround for https://github.com/cli/cli/issues/3425 and https://stackoverflow.com/questions/6714165/powershell-stripping-double-quotes-from-command-line-arguments
$title = $details.fields.{System.Title} -replace "`"","`\`""

$description=""

# bug doesn't have Description field - add repro steps and/or system info
Expand Down Expand Up @@ -141,7 +145,7 @@ ForEach($workitem in $query) {
$work_item_type = $details.fields.{System.WorkItemType}.ToLower()

# create the issue
$issue_url=gh issue create --body-file ./temp_issue_body.txt --repo "$gh_org/$gh_repo" --title $details.fields.{System.Title} --label $work_item_type
$issue_url=gh issue create --body-file ./temp_issue_body.txt --repo "$gh_org/$gh_repo" --title "$title" --label $work_item_type
write-host "issue created: $issue_url"

# update assigned to in GitHub if the option is set - tries to use ado email to map to github username
Expand Down

0 comments on commit 395e63e

Please sign in to comment.