Creating Pull Requests in AWS CodeCommit Using Bash

Automating tasks in software development has always been a priority for efficient software teams. The faster and more accurately we can execute repetitive tasks, the more time we have for value-added activities. In this post I am going to discuss a bash script that allows developers to automate the creation of pull requests in AWS CodeCommit. The script #!/usr/bin/env bash set -e REPO=`git config --get remote.origin.url` REPONAME=`basename "$REPO"` CURRENT_BRANCH="$(git symbolic-ref HEAD 2>/dev/null)" CURRENT_BRANCH=${BRANCH##refs/heads/} echo "I want to merge my branch into:" DEST=$(gum choose "develop" "master") echo $DEST sources=`git for-each-ref --format='%(refname:short)' refs/heads/ | grep -v $DEST | grep -v master | grep -v main` echo "This is the branch I want to merge:" SOURCE=$(gum choose ${sources}) echo $SOURCE TITLE=$(gum input --placeholder "Give me a title for this PR") echo TITLE=$TITLE gum confirm "Create PR '$TITLE' ($SOURCE -> $DEST)?...

August 11, 2023 ยท 4 min