Created
June 29, 2024 10:31
-
-
Save SirojbekMaqsudov/62e0662f080beed03ea705deb88b3542 to your computer and use it in GitHub Desktop.
Github CLI Automation
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
gh_pr() { | |
local base_branch=${1:-dev} | |
local head_branch=$2 | |
if [ -z "$head_branch" ]; then | |
head_branch=$(git rev-parse --abbrev-ref HEAD) | |
fi | |
if gh pr create -f --base "$base_branch" --head "$head_branch"; then | |
echo "Pull so'rovi yaratildi" | |
if gh pr merge --auto; then | |
echo "Merge qilindi" | |
else | |
echo "Xatolik: Merge qilinmadi" | |
fi | |
else | |
echo "Xatolik: Pull yaratilmadi" | |
fi | |
} | |
if [ $# -eq 0 ]; then | |
gh_pr | |
elif [ $# -eq 1 ]; then | |
gh_pr "$1" | |
else | |
gh_pr "$1" "$2" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment