diff --git a/scripts/pr-lib/gates.sh b/scripts/pr-lib/gates.sh index 4616d65c6d92..ffae1fd745e4 100644 --- a/scripts/pr-lib/gates.sh +++ b/scripts/pr-lib/gates.sh @@ -40,12 +40,19 @@ prepare_gates() { fi local has_changelog_update=false - if printf '%s\n' "$changed_files" | rg -q '^CHANGELOG\.md$'; then - has_changelog_update=true - fi - - local unsupported_changelog_fragments - unsupported_changelog_fragments=$(printf '%s\n' "$changed_files" | rg '^changelog/fragments/' || true) + local unsupported_changelog_fragments="" + local changed_path + while IFS= read -r changed_path; do + [ -n "$changed_path" ] || continue + case "$changed_path" in + CHANGELOG.md) + has_changelog_update=true + ;; + changelog/fragments/*) + unsupported_changelog_fragments="${unsupported_changelog_fragments}${changed_path}"$'\n' + ;; + esac + done <<<"$changed_files" if [ -n "$unsupported_changelog_fragments" ]; then echo "Unsupported changelog fragment files detected:" printf '%s\n' "$unsupported_changelog_fragments"