From 5a5a4b2df8ca8286d9bfc65a3b8948f0b8eb4b95 Mon Sep 17 00:00:00 2001 From: "Ivan Milosavljevic (TheJavaGuy)" Date: Sat, 28 Feb 2026 21:41:21 +0100 Subject: [PATCH] add create-pr.sh helper script for streamlined PR creation Closes #36 Adds a shell script that automates `gh pr create` with sensible defaults: derives PR title from branch name and auto-generates a body from the commit log since master, including a test checklist. Accepts optional [title] [body] overrides and guards against running directly on master. --- create-pr.sh | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100755 create-pr.sh diff --git a/create-pr.sh b/create-pr.sh new file mode 100755 index 0000000..11ccae6 --- /dev/null +++ b/create-pr.sh @@ -0,0 +1,54 @@ +#!/usr/bin/env bash +# Creates a PR from the current branch targeting this repo's master branch. +# Usage: ./create-pr.sh [title] [body] +# If title/body are omitted, they are derived from the branch name and commit log. + +set -euo pipefail + +REPO="TheJavaGuy/java-faker" +BASE="master" +BRANCH=$(git rev-parse --abbrev-ref HEAD) + +if [[ "$BRANCH" == "$BASE" ]]; then + echo "Error: already on $BASE — create a feature branch first." >&2 + exit 1 +fi + +# Use provided title or derive from branch name (kebab-case → sentence) +TITLE="${1:-$(echo "$BRANCH" | tr '-' ' ')}" + +# Use provided body or build from commits since master +if [[ $# -ge 2 ]]; then + BODY="$2" +else + COMMITS=$(git log "$BASE".."$BRANCH" --oneline) + BODY="$(cat <