Skip to content

Commit 65efd75

Browse files
committed
Merge branch 'dev'
2 parents c1e163c + d568258 commit 65efd75

File tree

4 files changed

+135
-0
lines changed

4 files changed

+135
-0
lines changed

.github/workflows/test-dev.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: Test Dev Branch
2+
on:
3+
push:
4+
branches: [dev]
5+
pull_request:
6+
branches: [dev]
7+
jobs:
8+
test:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v4
12+
- name: Set up Python
13+
uses: actions/setup-python@v5
14+
with:
15+
python-version: '3.11'
16+
- name: Install deps
17+
run: pip install pytest tiktoken
18+
- name: Run tests
19+
run: pytest tests/ -v

.gitignore

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Windows
2+
Thumbs.db
3+
Desktop.ini
4+
.BIN/
5+
6+
# macOS
7+
.DS_Store
8+
9+
# Python/Node
10+
__pycache__/
11+
*.py[cod]
12+
venv/
13+
env/
14+
.env
15+
node_modules/
16+
dist/
17+
build/
18+
19+
# Editors
20+
.vscode/
21+
.idea/
22+
23+
# Temp
24+
_temp/
25+
_trash/
26+
27+
*.pyc
28+
29+
*.egg-info/
30+
.pytest_cache/

pyproject.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[build-system]
2+
requires = ["setuptools>=61.0"]
3+
build-backend = "setuptools.build_meta"

setup-dev-branch.ps1

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
# setup-dev-branch.ps1 - AI Token Crusher Dev Branch Setup
2+
3+
$Token = "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"
4+
$Owner = "totalbrain"
5+
$Repo = "TokenOptimizer"
6+
7+
$Headers = @{
8+
Authorization = "Bearer $Token"
9+
Accept = "application/vnd.github+json"
10+
}
11+
12+
Write-Host "Creating dev branch setup..." -ForegroundColor Cyan
13+
14+
# 1. Create dev branch from main
15+
git checkout main
16+
git pull origin main
17+
git checkout -b dev
18+
git push origin dev
19+
20+
# 2. Set dev as default branch
21+
Invoke-RestMethod -Method Patch -Uri "https://api.github.com/repos/$Owner/$Repo" -Headers $Headers -Body (@{
22+
default_branch = "dev"
23+
} | ConvertTo-Json)
24+
25+
# 3. Protect main branch (require PR, 1 approval)
26+
$protect = @{
27+
required_pull_request_reviews = @{
28+
required_approving_review_count = 1
29+
}
30+
enforce_admins = $true
31+
}
32+
Invoke-RestMethod -Method Put -Uri "https://api.github.com/repos/$Owner/$Repo/branches/main/protection" -Headers $Headers -Body ($protect | ConvertTo-Json -Depth 10)
33+
34+
# 4. Update README with workflow
35+
$readme_content = @"
36+
## Workflow
37+
- Fork the repo
38+
- Create feature/issue-# branch from dev
39+
- Work on the issue
40+
- PR to dev
41+
- After tests/approve, merge to dev
42+
- For release: PR dev to main
43+
"@
44+
$readme_base64 = [Convert]::ToBase64String([Text.Encoding]::UTF8.GetBytes($readme_content))
45+
$existing_readme = Invoke-RestMethod "https://api.github.com/repos/$Owner/$Repo/contents/README.md" -Headers $Headers
46+
Invoke-RestMethod -Method Put -Uri "https://api.github.com/repos/$Owner/$Repo/contents/README.md" -Headers $Headers -Body (@{
47+
message = "Update README with workflow"
48+
content = $readme_base64
49+
sha = $existing_readme.sha
50+
} | ConvertTo-Json)
51+
52+
# 5. Create GitHub Actions for tests on dev
53+
mkdir .github/workflows -ErrorAction SilentlyContinue
54+
$actions_yaml = @"
55+
name: Test Dev Branch
56+
on:
57+
push:
58+
branches: [dev]
59+
pull_request:
60+
branches: [dev]
61+
jobs:
62+
test:
63+
runs-on: ubuntu-latest
64+
steps:
65+
- uses: actions/checkout@v4
66+
- name: Set up Python
67+
uses: actions/setup-python@v5
68+
with:
69+
python-version: '3.11'
70+
- name: Install deps
71+
run: pip install pytest tiktoken
72+
- name: Run tests
73+
run: pytest tests/ -v
74+
"@
75+
$actions_yaml | Out-File -FilePath ".github/workflows/test-dev.yml" -Encoding utf8
76+
77+
# 6. Commit and push
78+
git add .
79+
git commit -m "setup: dev branch workflow, protected main, actions tests"
80+
git push origin dev
81+
82+
Write-Host "All done! Dev branch is ready." -ForegroundColor Green
83+
Write-Host "Contributors now PR to dev, merge after tests, then PR dev to main for release." -ForegroundColor Green

0 commit comments

Comments
 (0)