32 lines
748 B
Bash
Executable File
32 lines
748 B
Bash
Executable File
#!/bin/bash
|
|
|
|
COMMIT_MSG=$(gum input --placeholder "Commit message...")
|
|
if [ -z "$COMMIT_MSG"]; then
|
|
echo "Commit cancelled..."
|
|
exit 1
|
|
fi
|
|
|
|
git add -A
|
|
git commit -m "$COMMIT_MSG"
|
|
|
|
BRANCH=$(git name-rev --name-only HEAD)
|
|
gum confirm "Push?" && git push origin $BRANCH
|
|
|
|
CREATE_PR=$(gum confirm "Create PR?")
|
|
|
|
if [[ "${!#}" == "-pr" && CREATE_PR -eq 0 ]]; then
|
|
REMOTE_BRANCHES=$(git branch -r | grep -v '\//' | sed 's/origin\///')
|
|
|
|
if echo "$remote_branches" | grep -q "^beta$"; then
|
|
PR_BASE="beta"
|
|
elif echo "$remote_branches" | grep -q "^main$"; then
|
|
PR_BASE="main"
|
|
elif echo "$remote_branches" | grep -q "^master$"; then
|
|
PR_BASE="master"
|
|
else
|
|
PR_BASE=$(REMOTE_BRANCHES | gum choose --limit 1 )
|
|
fi
|
|
|
|
gh pr create --base PR_BASE
|
|
fi
|