Skip to content

Instantly share code, notes, and snippets.

Last active December 7, 2022 03:10
What would you like to do?
my first gh command extension
#!/usr/bin/env bash
# Put this script into ~/.local/share/gh/extensions/gh-dev-pr/gh-dev-pr
set -e
CURRENT_BRANCH=$(git branch --contains | awk '{print $2}')
MAIN_PR=$(gh pr list --json title,url -H ${CURRENT_BRANCH})
DEV_PR_TITLE=$(echo ${MAIN_PR} | jq -r '.[0].title' | sed 's/^\[main\]/[develop]/')
DEV_PR_BODY=$(echo ${MAIN_PR} | jq -r '.[0].url')
exec gh pr create --base develop --title "${DEV_PR_TITLE}" --body "${DEV_PR_BODY}" --head "${CURRENT_BRANCH}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment