Parse long issue reference variant from body

Closes #40365

Signed-off-by: Alexander Schwartz <aschwart@redhat.com>
This commit is contained in:
Alexander Schwartz 2025-06-17 13:17:12 +02:00 committed by GitHub
parent 9a8335c885
commit e31064881b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 7 additions and 2 deletions

View File

@ -5,7 +5,7 @@ source ./pr-find-issues.sh
function testParsing() {
echo -n "$1 -> $2 "
if [ $(parse_issues "$1") != "$2" ]; then
if [ "$(parse_issues "$1")" != "$2" ]; then
echo "(failure)"
return 1
fi
@ -22,3 +22,4 @@ trap 'testFailed' ERR
testParsing "Closes #123" "123"
testParsing "Fixes #123" "123"
testParsing "Fixes: #123" "123"
testParsing "Fixes https://github.com/keycloak/keycloak/issues/123" "123"

View File

@ -8,7 +8,11 @@ if [ "$REPO" == "" ]; then
fi
function parse_issues() {
echo "$1" | grep -i -P -o "(close|closes|closed|resolve|resolves|resolved|fixes|fixed):? #[[:digit:]]*" | cut -d '#' -f 2 | sort -n
echo "$1" | \
grep -i -P -o "(close|closes|closed|resolve|resolves|resolved|fixes|fixed):? (#|https://github.com/keycloak/keycloak/issues/)[[:digit:]]*" | \
sed -e 's|https://github.com/keycloak/keycloak/issues/|#|g' | \
sed -e 's|keycloak/keycloak/issues/|#|g' | \
cut -d '#' -f 2 | sort -n
}
if [ "$PR" != "" ]; then