-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3b48772
commit e933f4f
Showing
5 changed files
with
47 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#!/bin/bash | ||
|
||
# Function to check for errors | ||
check_error() { | ||
if [ -n "$1" ]; then | ||
echo "Error: $1" | ||
afplay /System/Library/Sounds/Funk.aiff | ||
exit 1 | ||
fi | ||
} | ||
|
||
# Check if not in the main branch | ||
prBranchName=$(git branch --show-current) | ||
if [ "$prBranchName" = "main" ]; then | ||
check_error "Cannot start a review from main branch. Please switch to your development branch and try again." | ||
fi | ||
|
||
# Create PR | ||
gh pr create --base main --title "$prBranchName" --body "" 2>&1 | ||
pr_create_status=$? | ||
if [ $pr_create_status -ne 0 ]; then | ||
if [ "$(grep -q 'already exists' <<< "$pr_create_status"; echo $?)" -ne 0 ]; then | ||
check_error "Error creating PR" | ||
fi | ||
fi | ||
|
||
# Play success sound (Only works on MacOS) | ||
afplay /System/Library/Sounds/Glass.aiff | ||
|
||
# GitHub-Slack app sends a PR created Slack message to #content-updates channel | ||
check_error | ||
|
||
# Exit with success | ||
exit 0 |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#!/bin/bash | ||
|
||
requiredPackages=("gh" "git") | ||
|
||
for pkg in "${requiredPackages[@]}"; do | ||
if ! which "$pkg" &>/dev/null; then | ||
echo "$pkg is not installed" | ||
exit 1 | ||
fi | ||
done |
This file was deleted.
Oops, something went wrong.