feat(git-control): add Git repository and branch access control features
- Introduced new scripts for managing Gitea repository permissions, including branch protection, user access, and organization-wide settings. - Added documentation for the git-control skill, detailing API usage and capabilities. - Included .gitignore to prevent committing sensitive configuration files. - Created references for Gitea API endpoints related to branch protection and user permissions.
This commit is contained in:
@@ -0,0 +1,55 @@
|
||||
# Gitea API Reference for Git Control
|
||||
|
||||
Base: `{GiteaBaseUrl}/api/v1`
|
||||
Auth: `Authorization: token {ApiToken}`
|
||||
|
||||
## Branch Protection
|
||||
|
||||
| Action | Method | Path |
|
||||
|--------|--------|------|
|
||||
| List | GET | `/repos/{owner}/{repo}/branch_protections` |
|
||||
| Create | POST | `/repos/{owner}/{repo}/branch_protections` |
|
||||
| Get | GET | `/repos/{owner}/{repo}/branch_protections/{name}` |
|
||||
| Edit | PATCH | `/repos/{owner}/{repo}/branch_protections/{name}` |
|
||||
| Delete | DELETE | `/repos/{owner}/{repo}/branch_protections/{name}` |
|
||||
|
||||
**CreateBranchProtectionOption** (POST body):
|
||||
- `branch_name`: pattern (e.g. `uat`, `main`)
|
||||
- `enable_push`: false = no direct push
|
||||
- `enable_merge_whitelist`: true + empty lists = no one can merge
|
||||
- `merge_whitelist_usernames`: []
|
||||
- `merge_whitelist_teams`: []
|
||||
|
||||
## Organizations & Repositories
|
||||
|
||||
| Action | Method | Path | Note |
|
||||
|--------|--------|------|------|
|
||||
| List all orgs | GET | `/admin/orgs` | Admin only |
|
||||
| List org repos | GET | `/orgs/{org}/repos` | Pagination: page, limit |
|
||||
| List user repos | GET | `/user/repos` | Current user |
|
||||
| Search repos | GET | `/repos/search` | q, page, limit |
|
||||
|
||||
## Collaborators (User Repo Permissions)
|
||||
|
||||
| Action | Method | Path |
|
||||
|--------|--------|------|
|
||||
| List | GET | `/repos/{owner}/{repo}/collaborators` |
|
||||
| Add/Update | PUT | `/repos/{owner}/{repo}/collaborators/{username}` |
|
||||
| Remove | DELETE | `/repos/{owner}/{repo}/collaborators/{username}` |
|
||||
| Check | GET | `/repos/{owner}/{repo}/collaborators/{username}` |
|
||||
|
||||
**PUT body**: `{"permission": "read"|"write"|"admin"}`
|
||||
|
||||
## Organization Teams (Org-level Permissions)
|
||||
|
||||
| Action | Method | Path |
|
||||
|--------|--------|------|
|
||||
| List org teams | GET | `/orgs/{org}/teams` |
|
||||
| List team repos | GET | `/teams/{id}/repos` |
|
||||
| Add repo to team | PUT | `/teams/{id}/repos/{org}/{repo}` |
|
||||
| Remove repo from team | DELETE | `/teams/{id}/repos/{org}/{repo}` |
|
||||
| List team members | GET | `/teams/{id}/members` |
|
||||
| Add member | PUT | `/teams/{id}/members/{username}` |
|
||||
| Remove member | DELETE | `/teams/{id}/members/{username}` |
|
||||
|
||||
Team permission: `permission` = "none"|"read"|"write"|"admin"|"owner"
|
||||
Reference in New Issue
Block a user