Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
78 changes: 78 additions & 0 deletions .github/workflows/branch-flow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
name: "Branch Flow Protection"

on:
pull_request:

jobs:
enforce-branch-flow:
runs-on: ubuntu-latest

steps:
- name: Validate PR branch flow
env:
SOURCE: ${{ github.head_ref }}
TARGET: ${{ github.base_ref }}

run: |
echo "PR: $SOURCE -> $TARGET"

case "$SOURCE" in

# Block main going into lower branches
main)
echo "🚀 $SOURCE -❌-> 🎯 $TARGET"
echo " "
echo "❌ main cannot merge downward."
echo "⚠️ Error: Merging from main into '$TARGET' is prohibited."
exit 1
;;

# Hotfix/* branches can only go into main
hotfix/*)
if [[ "$TARGET" != "main" ]]; then
echo "🚀 $SOURCE -❌-> 🎯 $TARGET"
echo " "
echo "❌ hotfix/* branches must target main."
echo "⚠️ Error: Merging from $SOURCE into '$TARGET' is prohibited."
exit 1
fi
;;

# Develop branches can only go into main
develop)
if [["$TARGET" != "main" ]]; then
echo "🚀 $SOURCE -❌-> 🎯 $TARGET"
echo " "
echo "❌ develop branch must target main."
echo "⚠️ Error: Merging from $SOURCE into '$TARGET' is prohibited."
exit 1
fi
;;

# Features/* branches can only go into develop
feature/*)
if [[ "$TARGET" != "develop" ]]; then
echo "🚀 $SOURCE -❌-> 🎯 $TARGET"
echo " "
echo "❌ feature/* branches must target develop."
echo "⚠️ Error: Merging from $SOURCE into '$TARGET' is prohibited."
exit 1
fi
;;

# Bugfixes/* branches can only go into develop
bugfix/*)
if [[ "$TARGET" != "develop" ]]; then
echo "🚀 $SOURCE -❌-> 🎯 $TARGET"
echo " "
echo "❌ bugfix/* branches must target develop."
echo "⚠️ Error: Merging from $SOURCE into '$TARGET' is prohibited."
exit 1
fi
;;

esac

echo "✅ Branch flow is valid."
echo " "
echo "🚀 $SOURCE -✅-> 🎯 $TARGET"
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Node Shapes
64 changes: 6 additions & 58 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

31 changes: 24 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,34 @@
{
"name": "shapes",
"version": "1.0.0",
"description": "",
"name": "node-shapes",
"version": "0.0.1",
"description": "A JavaScript library for creating diagrams and flowcharts, with JSON export support.",
"main": "index.js",
"license": "MIT",
"private": false,
"type": "commonjs",
"scripts": {
"dev": "vite",
"build": "vite build",
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"type": "commonjs",
"keywords": [
"diagram",
"flowchart",
"shapes",
"nodes",
"javascript",
"visualization",
"json"
],
"author": "Muhammad Rukban Ali Yousaf",
"repository": {
"type": "git",
"url": "git+https://github.com/QBitFoundry/node-shapes.git"
},
"bugs": {
"url": "https://github.com/QBitFoundry/node-shapes/issues"
},
"homepage": "https://github.com/QBitFoundry/node-shapes#readme",
"devDependencies": {
"typescript": "^6.0.3",
"vite": "^8.0.16"
Expand Down