fix changelog checker in CI to regex escape the submitter username

This commit is contained in:
Keith Hall 2024-01-03 16:34:18 +02:00
parent 05ccdcd27b
commit 15178bca3f
1 changed files with 11 additions and 1 deletions

View File

@ -29,5 +29,15 @@ jobs:
ADDED=$(git diff -U0 "origin/${PR_BASE}" HEAD -- CHANGELOG.md | grep -P '^\+[^\+].+$')
echo "Added lines in CHANGELOG.md:"
echo "$ADDED"
escape_regex_meta_chars() {
# https://stackoverflow.com/a/16951928/4473405
sed 's/[][\.|$(){}?+*^]/\\&/g' <<< "$*"
}
double_escape_slash_for_bash() {
sed 's/\\/\\\\/g' <<< "$*"
}
echo "Grepping for PR info:"
grep "#${PR_NUMBER}\\b.*@${PR_SUBMITTER}\\b" <<< "$ADDED"
grep "#${PR_NUMBER}\\b.*[(]@$(quote ${PR_SUBMITTER})[)]" <<< "$ADDED"