Skip to content

fix(scripts/release): handle cherry-pick bot titles in check commit metadata #17535

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 23, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions scripts/release/check_commit_metadata.sh
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,23 @@ main() {
title2=${parts2[*]:2}
fi

# Handle cherry-pick bot, it turns "chore: foo bar (#42)" to
# "chore: foo bar (cherry-pick #42) (#43)".
if [[ ${title1} == *"(cherry-pick #"* ]]; then
title1=${title1%" ("*}
pr=${title1##*#}
pr=${pr%)}
title1=${title1%" ("*}
title1="${title1} (#${pr})"$'\n'
fi
if [[ ${title2} == *"(cherry-pick #"* ]]; then
title2=${title2%" ("*}
pr=${title2##*#}
pr=${pr%)}
title2=${title2%" ("*}
title2="${title2} (#${pr})"$'\n'
fi

if [[ ${title1} != "${title2}" ]]; then
log "Invariant failed, cherry-picked commits have different titles: \"${title1%$'\n'}\" != \"${title2%$'\n'}\", attempting to check commit body for cherry-pick information..."

Expand Down
Loading