Closed felickz closed 4 months ago
TODO: look into this here
27
The fix for handling empty target branch alerts (https://github.com/microsoft/GHAzDO-Resources/issues/27) worked well on my end. Consider changing line 172 from this:
# Check for alert ids that are reported in the PR source branch but not the pr target branch
$newAlertIds = Compare-Object $prSourceAlertIds $prTargetAlertIds -PassThru | Where-Object { $_.SideIndicator -eq '<=' }
To this:
# Fix for cases where the garget branch does not contain any alerts. Source: https://github.com/microsoft/GHAzDO-Resources/issues/27
if ($null -eq $prTargetAlertIds) {
$newAlertIds = $prSourceAlertIds
} else {
# Check for alert ids that are reported in the PR source branch but not the pr target branch
$newAlertIds = Compare-Object $prSourceAlertIds $prTargetAlertIds -PassThru | Where-Object { $_.SideIndicator -eq '<=' }
}
This pull request includes significant changes to the
src/pr-gating/CIGate.ps1
script, which is used for PR gating strategy. The changes enhance the script's functionality by improving alert handling and logging, and by modifying the script's variables and methods for better clarity and efficiency.Key changes include:
:
)$alertTypes
,$severityPolicy
to handle different types of alerts to create a policycode
anddependency
alerts are returnedAddPRComment
function to handle both dependency and code alerts. The function now checks the severity of the alert against a predefined policy before logging and reporting the alert. [1] [2] [3]These changes improve the script's ability to handle and report alerts, making it easier for developers to identify and fix potential issues in their code.
PR comment example: