mirror of
https://github.com/spring-projects/spring-petclinic.git
synced 2026-02-04 21:31:11 +00:00
feat : added scripts
This commit is contained in:
parent
ab1d5364a0
commit
eabb63417a
2 changed files with 60 additions and 0 deletions
33
scripts/git/new-feature.sh
Normal file
33
scripts/git/new-feature.sh
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
#!/usr/bin/env bash
|
||||
set -e
|
||||
|
||||
echo "=== Create New Feature Branch ==="
|
||||
|
||||
# Check if git repo
|
||||
if ! git rev-parse --is-inside-work-tree >/dev/null 2>&1; then
|
||||
echo "❌ Not inside a git repository"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
read -p "Enter JIRA ticket (e.g. JIRA-123): " JIRA
|
||||
read -p "Enter short description: " DESC
|
||||
|
||||
if [[ -z "$JIRA" || -z "$DESC" ]]; then
|
||||
echo "❌ JIRA ticket and description are required"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Clean description
|
||||
DESC_CLEAN=$(echo "$DESC" | tr '[:upper:]' '[:lower:]' | tr ' ' '-')
|
||||
|
||||
BRANCH="feature/${JIRA}-${DESC_CLEAN}"
|
||||
|
||||
echo "📌 Creating branch: $BRANCH"
|
||||
|
||||
git fetch origin
|
||||
git checkout develop
|
||||
git pull origin develop
|
||||
git checkout -b "$BRANCH"
|
||||
git push -u origin "$BRANCH"
|
||||
|
||||
echo "✅ Feature branch created and pushed successfully"
|
||||
27
scripts/git/pr-ready.sh
Normal file
27
scripts/git/pr-ready.sh
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
#!/usr/bin/env bash
|
||||
set -e
|
||||
|
||||
echo "=== PR Readiness Check ==="
|
||||
|
||||
CURRENT_BRANCH=$(git branch --show-current)
|
||||
|
||||
if [[ "$CURRENT_BRANCH" == "develop" || "$CURRENT_BRANCH" == "main" ]]; then
|
||||
echo "❌ PR cannot be raised from $CURRENT_BRANCH"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "✔ Current branch: $CURRENT_BRANCH"
|
||||
|
||||
git fetch origin
|
||||
|
||||
if git merge-base --is-ancestor origin/develop HEAD; then
|
||||
echo "✔ Branch is up to date with develop"
|
||||
else
|
||||
echo "❌ Branch is behind develop"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "✔ Running tests (POC)"
|
||||
./mvnw test || { echo "❌ Tests failed"; exit 1; }
|
||||
|
||||
echo "✅ PR is READY"
|
||||
Loading…
Add table
Add a link
Reference in a new issue