-
-
Save rhoboro/3b6404babfbaaddf881b206f6c4949f3 to your computer and use it in GitHub Desktop.
my first gh command extension
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
#!/usr/bin/env bash | |
# https://docs.github.com/en/github-cli/github-cli/creating-github-cli-extensions | |
# 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