Skip to content

Commit 7dae01f

Browse files
committed
Merge remote-tracking branch 'upstream/test-redirect-gh-action' into regex
2 parents 30ee742 + e52f3af commit 7dae01f

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

.github/workflows/add-redirects.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,8 @@ jobs:
8585
redirect='${prefix}/${version}'"$old"'/ -> ${base}/${version}/'
8686
8787
# if redirect not already in file, add to string to add to PR description
88-
if ! grep -q "$redirect" $REDIRECTS_FILE && [[ "$redirect" != *'${base}/${version}/' ]]; then
88+
escaped_redirect=$(printf '%s\n' "$redirect" | sed 's/[.[\*^$()+?{}|\\]/\\&/g')
89+
if ! grep -qE "${escaped_redirect}$" "$REDIRECTS_FILE"; then
8990
deleted_redirects+="<li>[&lt;v&gt;-*]: $redirect</li>"
9091
fi
9192
done

0 commit comments

Comments
 (0)