Swadhin Biswas style: fix prettier formatting issues · 3/30/2026
89ff316
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#!/bin/bash
# Branch Protection Setup Script for Linuxy - Develop Branch
# Usage: ./scripts/setup-develop-branch.sh [GITHUB_TOKEN]
set -e
REPO="swadhinbiswas/linuxy"
BRANCH="develop"
GITHUB_TOKEN="${1:-$GITHUB_TOKEN}"
if [ -z "$GITHUB_TOKEN" ]; then
echo "Error: GitHub token required"
echo "Usage: $0 <GITHUB_TOKEN>"
echo "Or set GITHUB_TOKEN environment variable"
exit 1
fi
echo "Setting up branch protection for $REPO/$BRANCH..."
# Check if branch exists
BRANCH_EXISTS=$(curl -s -H "Authorization: token $GITHUB_TOKEN" \
"$API/repos/$REPO/branches/$BRANCH" | jq -r '.name // empty')
if [ -z "$BRANCH_EXISTS" ]; then
echo "Branch 'develop' doesn't exist. Creating it from main..."
# Create develop branch from main
MAIN_SHA=$(curl -s -H "Authorization: token $GITHUB_TOKEN" \
"$API/repos/$REPO/branches/main" | jq -r '.commit.sha')
curl -s -X POST "$API/repos/$REPO/git/refs/refs/heads/$BRANCH" \
-H "Authorization: token $GITHUB_TOKEN" \
-H "Accept: application/vnd.github+json" \
-d "{\"sha\": \"$MAIN_SHA\", \"ref\": \"refs/heads/$BRANCH\"}"
echo "✓ Created develop branch"
fi
# API Base URL
API="https://api.github.com"
PROTECTION_URL="$API/repos/$REPO/branches/$BRANCH/protection"
echo "✓ Configuring protection for develop..."
# Basic protection for develop
curl -s -X PUT "$PROTECTION_URL" \
-H "Authorization: token $GITHUB_TOKEN" \
-H "Accept: application/vnd.github+json" \
-H "Content-Type: application/json" \
-d '{
"required_status_checks": {
"strict": false,
"contexts": [
"Frontend Lint & Build",
"Rust Check & Test"
]
},
"enforce_admins": true,
"required_pull_request_reviews": {
"dismiss_stale_reviews": false,
"required_approving_review_count": 1
},
"restrictions": null,
"allow_force_pushes": false,
"allow_deletions": false,
"require_conversation_resolution": false
}'
echo ""
echo "✅ Branch protection configured for develop!"