Skip to content

Commit

Permalink
do not exit when pr analyze failed, write warning instead
Browse files Browse the repository at this point in the history
  • Loading branch information
VeryEarly committed Sep 10, 2024
1 parent 98d93c6 commit 0e6ecaf
Showing 1 changed file with 17 additions and 13 deletions.
30 changes: 17 additions & 13 deletions .azure-pipelines/util/build-steps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -124,20 +124,18 @@ steps:
}
}
if ($noGenerateInfo -and $noGenerateInfo.Count -gt 0) {
$noGenerateInfo | Foreach-Object { Write-Error "No generate-info.json detected for $_" }
exit 1
$noGenerateInfo | Foreach-Object { Write-Host "##vso[task.logissue type=warning]No generate-info.json detected for $_."}
}
Write-Host "##[endgroup]"
# # this might not be true, for example when release branch or preview branch merge back to main branch, it's possible changes present in both /src and /generated
# Write-Host "##[group]#2. PR should contain changes from either /src or /generated only"
# $srcFiles = Get-Content $(FilesChangedOutputPath) | Where-Object { $_ -match "^src.*" }
# $generatedFiles = Get-Content $(FilesChangedOutputPath) | Where-Object { $_ -match "^generated.*" }
# if ($srcFiles -and $srcFiles.Count -gt 0 -and $generatedFiles -and $generatedFiles.Count -gt 0) {
# Write-Error "PR should contain changes from either /src or /generated only"
# exit 1
# }
# Write-Host "##[endgroup]"
# this might not be true, for example when release branch or preview branch merge back to main branch, it's possible changes present in both /src and /generated
Write-Host "##[group]#2. PR should contain changes from either /src or /generated only"
$srcFiles = Get-Content $(FilesChangedOutputPath) | Where-Object { $_ -match "^src.*" }
$generatedFiles = Get-Content $(FilesChangedOutputPath) | Where-Object { $_ -match "^generated.*" }
if ($srcFiles -and $srcFiles.Count -gt 0 -and $generatedFiles -and $generatedFiles.Count -gt 0) {
Write-Host "##vso[task.logissue type=warning]PR should contain changes from either /src or /generated only."
}
Write-Host "##[endgroup]"
- task: NodeTool@0
displayName: Install Autorest
inputs:
Expand Down Expand Up @@ -202,15 +200,21 @@ steps:
targetType: inline
pwsh: true
script: |
if ("Commit" -eq "$(TriggerType)") {
$prTitle = "[skip ci] Archive $(Trigger)"
} elseif ("TargetModule" -eq "$(TriggerType)") {
$prTitle = "[skip ci] Archive selected modules"
} else {
return
}
$tmpBranchName = "$(TmpBranchName)"
$baseBranchName = "$(BaseBranchName)"
$generatedPath = Join-Path "$(Build.SourcesDirectory)" 'generated'
$diff = ( git status --short --untracked-files $generatedPath)
if ((-not $diff) -or ($null -eq $diff) -or (0 -eq $diff.Count)) {
return
}
$prTitle = "[skip ci] Archive generated assets to $baseBranchName"
$prDescription = "triggered by: $(TriggerType) ($(Trigger))"
$prScriptPath = Join-Path "$(Build.SourcesDirectory)" 'tools' 'Github' 'CreatePR.ps1'
Expand Down

0 comments on commit 0e6ecaf

Please sign in to comment.