Skip to content

Commit 158d622

Browse files
committed
add prefix check
1 parent c75fa96 commit 158d622

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

.github/workflows/deploy-preview.yaml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,10 @@ jobs:
2525
USER_NAME: ${{ github.event.pull_request.user.login }}
2626
BRANCH_NAME: ${{ github.event.pull_request.head.ref }}
2727
run: |
28-
if [[ "${BRANCH_NAME,,}" != "${USER_NAME/,,}"* ]]; then
28+
PREFIX="${BRANCH_NAME%%/*}"
29+
lower_user_name="${USER_NAME,,}"
30+
lower_prefix="${PREFIX,,}"
31+
if [[ "$lower_prefix" != "$lower_user_name" ]]; then
2932
echo "Invalid branch name. Please ensure that your PR branch name starts with your GitHub username in the format of <username>/<branch-name>. Eg. myusername/my-feature"
3033
exit 1
3134
fi
@@ -71,7 +74,10 @@ jobs:
7174
env:
7275
USER_NAME: ${{ github.event.pull_request.user.login }}
7376
run: |
74-
if [[ "${BRANCH_NAME,,}" != "${USER_NAME/,,}"* ]]; then
77+
PREFIX="${BRANCH_NAME%%/*}"
78+
lower_user_name="${USER_NAME,,}"
79+
lower_prefix="${PREFIX,,}"
80+
if [[ "$lower_prefix" != "$lower_user_name" ]]; then
7581
echo "Invalid branch name. Please ensure that your PR branch name starts with your GitHub username in the format of <username>/<branch-name>. Eg. myusername/my-feature"
7682
exit 1
7783
fi

0 commit comments

Comments
 (0)