forked from solana-mobile/solana-mobile-doc-site
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ignoreBuildScript.sh
32 lines (23 loc) · 987 Bytes
/
ignoreBuildScript.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/bin/bash
# List of authorized GitHub usernames
AUTHORIZED_USERS="Michaelsulistio,ankur2136,emmett-solana,Funkatronics,J909,konoart,oliveeyay,sdlaver"
# Extract the GitHub username from the VERCEL_GIT_COMMIT_AUTHOR_LOGIN environment variable
COMMIT_AUTHOR=$VERCEL_GIT_COMMIT_AUTHOR_LOGIN
# Debugging: Print out relevant environment variables
echo "Debugging information:"
echo "VERCEL_GIT_COMMIT_REF: $VERCEL_GIT_COMMIT_REF"
echo "VERCEL_GIT_COMMIT_AUTHOR_LOGIN: $VERCEL_GIT_COMMIT_AUTHOR_LOGIN"
echo "VERCEL_GIT_PULL_REQUEST_ID: $VERCEL_GIT_PULL_REQUEST_ID"
# Check if we're on the main branch (always build this)
if [[ "$VERCEL_GIT_COMMIT_REF" == "main" ]] ; then
echo "✅ - Build can proceed"
exit 1;
fi
# Check if the commit author is in the list of authorized users
if [[ $AUTHORIZED_USERS == *"$COMMIT_AUTHOR"* ]] ; then
echo "✅ - Build can proceed: PR from authorized user"
exit 1;
else
echo "🛑 - Build cancelled: PR from unauthorized user"
exit 0;
fi