Skip to content

Instantly share code, notes, and snippets.

@SirojbekMaqsudov
Created June 29, 2024 10:31
Show Gist options
  • Save SirojbekMaqsudov/62e0662f080beed03ea705deb88b3542 to your computer and use it in GitHub Desktop.
Save SirojbekMaqsudov/62e0662f080beed03ea705deb88b3542 to your computer and use it in GitHub Desktop.
Github CLI Automation
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