@robosystems/client 0.1.18 → 0.1.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/create-feature +91 -0
- package/package.json +7 -1
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
set -e
|
|
3
|
+
|
|
4
|
+
# Create feature branch script using GitHub Actions
|
|
5
|
+
# Creates a new feature/bugfix/hotfix branch from specified base
|
|
6
|
+
# Usage: ./bin/create-feature [feature|bugfix|hotfix|chore|refactor] [branch-name] [base-branch]
|
|
7
|
+
|
|
8
|
+
# Default values
|
|
9
|
+
BRANCH_TYPE=${1:-feature}
|
|
10
|
+
BRANCH_NAME=${2:-}
|
|
11
|
+
BASE_BRANCH=${3:-main}
|
|
12
|
+
|
|
13
|
+
# Validate branch type
|
|
14
|
+
if [[ "$BRANCH_TYPE" != "feature" && "$BRANCH_TYPE" != "bugfix" && "$BRANCH_TYPE" != "hotfix" && "$BRANCH_TYPE" != "chore" && "$BRANCH_TYPE" != "refactor" ]]; then
|
|
15
|
+
echo "❌ Invalid branch type: $BRANCH_TYPE"
|
|
16
|
+
echo "Usage: $0 [feature|bugfix|hotfix|chore|refactor] [branch-name] [base-branch]"
|
|
17
|
+
exit 1
|
|
18
|
+
fi
|
|
19
|
+
|
|
20
|
+
# Check if branch name is provided
|
|
21
|
+
if [ -z "$BRANCH_NAME" ]; then
|
|
22
|
+
echo "❌ Branch name is required"
|
|
23
|
+
echo "Usage: $0 [feature|bugfix|hotfix|chore|refactor] [branch-name] [base-branch]"
|
|
24
|
+
exit 1
|
|
25
|
+
fi
|
|
26
|
+
|
|
27
|
+
# Sanitize branch name
|
|
28
|
+
SANITIZED_NAME=$(echo "$BRANCH_NAME" | sed 's/[^a-zA-Z0-9-]/-/g' | sed 's/--*/-/g' | sed 's/^-//;s/-$//' | tr '[:upper:]' '[:lower:]')
|
|
29
|
+
FULL_BRANCH_NAME="$BRANCH_TYPE/$SANITIZED_NAME"
|
|
30
|
+
|
|
31
|
+
echo "🌿 Creating feature branch..."
|
|
32
|
+
echo "📋 Branch Details:"
|
|
33
|
+
echo " Type: $BRANCH_TYPE"
|
|
34
|
+
echo " Name: $SANITIZED_NAME"
|
|
35
|
+
echo " Full Name: $FULL_BRANCH_NAME"
|
|
36
|
+
echo " Base Branch: $BASE_BRANCH"
|
|
37
|
+
echo ""
|
|
38
|
+
|
|
39
|
+
# Check for uncommitted changes
|
|
40
|
+
if ! git diff --quiet || ! git diff --cached --quiet; then
|
|
41
|
+
echo "⚠️ You have uncommitted changes. Please commit or stash them first."
|
|
42
|
+
echo ""
|
|
43
|
+
echo "Uncommitted files:"
|
|
44
|
+
git status --porcelain
|
|
45
|
+
exit 1
|
|
46
|
+
fi
|
|
47
|
+
|
|
48
|
+
echo "🚀 Triggering GitHub Actions workflow..."
|
|
49
|
+
gh workflow run create-feature.yml \
|
|
50
|
+
--field branch_type="$BRANCH_TYPE" \
|
|
51
|
+
--field branch_name="$BRANCH_NAME" \
|
|
52
|
+
--field base_branch="$BASE_BRANCH"
|
|
53
|
+
|
|
54
|
+
echo "⏳ Waiting for branch to be created..."
|
|
55
|
+
|
|
56
|
+
# Wait for the branch to be created (check every 5 seconds for up to 1 minute)
|
|
57
|
+
MAX_ATTEMPTS=12
|
|
58
|
+
ATTEMPT=1
|
|
59
|
+
|
|
60
|
+
while [ $ATTEMPT -le $MAX_ATTEMPTS ]; do
|
|
61
|
+
echo "Attempt $ATTEMPT/$MAX_ATTEMPTS: Checking if branch exists..."
|
|
62
|
+
|
|
63
|
+
# Fetch latest changes from remote
|
|
64
|
+
git fetch origin --quiet
|
|
65
|
+
|
|
66
|
+
# Check if the branch exists on remote
|
|
67
|
+
if git show-ref --verify --quiet refs/remotes/origin/$FULL_BRANCH_NAME; then
|
|
68
|
+
echo "✅ Branch $FULL_BRANCH_NAME found! Checking it out..."
|
|
69
|
+
git checkout -b $FULL_BRANCH_NAME origin/$FULL_BRANCH_NAME 2>/dev/null || git checkout $FULL_BRANCH_NAME
|
|
70
|
+
|
|
71
|
+
echo "🎉 Successfully created and switched to $FULL_BRANCH_NAME"
|
|
72
|
+
echo ""
|
|
73
|
+
echo "📝 Next steps:"
|
|
74
|
+
echo " 1. Make your changes and commit them"
|
|
75
|
+
echo " 2. Push your changes: git push"
|
|
76
|
+
echo " 3. Create a PR when ready: npm run pr:create"
|
|
77
|
+
|
|
78
|
+
exit 0
|
|
79
|
+
fi
|
|
80
|
+
|
|
81
|
+
if [ $ATTEMPT -eq $MAX_ATTEMPTS ]; then
|
|
82
|
+
echo "❌ Timeout: Branch $FULL_BRANCH_NAME was not created after 1 minute"
|
|
83
|
+
echo "Check the GitHub Actions workflow status:"
|
|
84
|
+
echo " gh run list --workflow=create-feature.yml"
|
|
85
|
+
exit 1
|
|
86
|
+
fi
|
|
87
|
+
|
|
88
|
+
echo "Branch not yet available, waiting 5 seconds..."
|
|
89
|
+
sleep 5
|
|
90
|
+
ATTEMPT=$((ATTEMPT + 1))
|
|
91
|
+
done
|
package/package.json
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@robosystems/client",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.19",
|
|
4
4
|
"description": "TypeScript client library for RoboSystems Financial Knowledge Graph API",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
7
|
+
"bin": {
|
|
8
|
+
"create-feature": "./bin/create-feature"
|
|
9
|
+
},
|
|
7
10
|
"exports": {
|
|
8
11
|
".": {
|
|
9
12
|
"types": "./index.d.ts",
|
|
@@ -68,6 +71,9 @@
|
|
|
68
71
|
"lint:fix": "eslint . --fix",
|
|
69
72
|
"typecheck": "tsc --noEmit",
|
|
70
73
|
"validate": "npm run format:check && npm run lint && npm run typecheck",
|
|
74
|
+
"feature:create": "./bin/create-feature",
|
|
75
|
+
"release:create": "./bin/create-release",
|
|
76
|
+
"pr:create": "./bin/create-pr",
|
|
71
77
|
"validate:fix": "npm run format && npm run lint:fix && npm run typecheck",
|
|
72
78
|
"test": "npm run validate",
|
|
73
79
|
"test:all": "npm run validate && npm run build",
|