I try to replace some value in the json file, and then submit the update json file to the git repo. But the json file add extra \r\n
.
My test scripts is below:
$TempFile = "$(System.DefaultWorkingDirectory)\LogicApp\workflows\$WorkflowName\workflow.json"
$WorkflowForParametersupdate = (Get-Content -Path "$TempFile" -Raw) -replace $Devobj.Value,$($_.Value) | ConvertFrom-Json
$WorkflowForParametersupdate = $WorkflowForParametersupdate | ConvertTo-Json -depth 100 | Out-File -FilePath $TempFile -Force
Then I submit those files back to my git repo by git command:
cd $(System.DefaultWorkingDirectory)
cd LogicApp\Workflows
git config --global user.email "XXXXX"
git config --global user.name "XXXXX"
git add *
git commit -m "Add workflow deploy files"
git -c http.extraHeader="Authorization: Basic $(System.AccessToken)" push
git push https://$(PAT)@dev.azure.com/XXXXX/_git/XXX-XXXXXHEAD:SIT
But the result will be added \r\n
:
How to resolve this issue? I do not want to replace those \r\n
, I want just not add them to the git repo at first.