feat(org): add org-level branch protection rulesets & configurable help URLs #72

Merged
jmiller merged 2 commits from feature/org-branch-protection into dev 2026-05-12 20:24:15 +00:00
Owner

Summary

  • Add org-level branch protection rulesets that cascade to all repos in the org
  • Repo-level rules take precedence; org rules serve as fallback
  • Full CRUD API: GET/POST/PATCH/DELETE /api/v1/orgs/{org}/branch_protections
  • Add configurable HELP_URL and SUPPORT_URL settings (replaces hardcoded docs.gitea.com)
  • Show Help/Support URLs in Site Admin > Configuration
  • Establish 1261.xx.xx version convention for MokoGitea fork

Changes

Org Branch Protection (8 files)

  • New migration v332: org_protected_branch table
  • OrgProtectedBranch model with CRUD + glob matching
  • API handlers with reqToken() + reqOrgOwnership() auth
  • Inheritance logic in GetFirstMatchProtectedBranchRule()
  • InheritedFrom field on BranchProtection API response

Help/Support URLs (7 files)

  • HELP_URL / SUPPORT_URL in app.ini global section
  • Navbar uses {{HelpURL}} template function instead of hardcoded URL
  • Admin config page displays current values

Test plan

  • Create org rule via API, verify it applies to repos without their own rule
  • Verify repo-level rule overrides org rule for same branch pattern
  • Verify rule deletion at org level removes protection from all repos
  • Run existing branch protection tests for regressions
  • Set HELP_URL in app.ini, verify navbar links update
  • Verify admin config page shows Help/Support URLs

Closes #38

🤖 Generated with Claude Code
Co-Authored-By: Claude Opus 4.6 (1M context) noreply@anthropic.com

## Summary - Add org-level branch protection rulesets that cascade to all repos in the org - Repo-level rules take precedence; org rules serve as fallback - Full CRUD API: `GET/POST/PATCH/DELETE /api/v1/orgs/{org}/branch_protections` - Add configurable `HELP_URL` and `SUPPORT_URL` settings (replaces hardcoded docs.gitea.com) - Show Help/Support URLs in Site Admin > Configuration - Establish `1261.xx.xx` version convention for MokoGitea fork ## Changes ### Org Branch Protection (8 files) - New migration v332: `org_protected_branch` table - `OrgProtectedBranch` model with CRUD + glob matching - API handlers with `reqToken() + reqOrgOwnership()` auth - Inheritance logic in `GetFirstMatchProtectedBranchRule()` - `InheritedFrom` field on `BranchProtection` API response ### Help/Support URLs (7 files) - `HELP_URL` / `SUPPORT_URL` in `app.ini` global section - Navbar uses `{{HelpURL}}` template function instead of hardcoded URL - Admin config page displays current values ## Test plan - [ ] Create org rule via API, verify it applies to repos without their own rule - [ ] Verify repo-level rule overrides org rule for same branch pattern - [ ] Verify rule deletion at org level removes protection from all repos - [ ] Run existing branch protection tests for regressions - [ ] Set `HELP_URL` in app.ini, verify navbar links update - [ ] Verify admin config page shows Help/Support URLs Closes #38 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
jmiller added 2 commits 2026-05-12 20:22:57 +00:00
Add organization-scoped branch protection rules that cascade to all
repos within the org. Repo-level rules take precedence; org rules
serve as the fallback when no repo rule matches a branch.

- New table: org_protected_branch (migration v332)
- OrgProtectedBranch model with full CRUD operations
- API endpoints: GET/POST/PATCH/DELETE /api/v1/orgs/{org}/branch_protections
- Inheritance via GetFirstMatchProtectedBranchRule() fallback
- InheritedFrom field added to BranchProtection API response
- Org rules use team-based whitelists (no per-user IDs at org level)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
feat(admin): add configurable Help/Support URLs and version convention
db-tests / files-changed (pull_request) Successful in 6s
docker-dryrun / files-changed (pull_request) Successful in 7s
labeler / labeler (pull_request_target) Successful in 11s
pr-title / lint-pr-title (pull_request) Successful in 3m9s
compliance / files-changed (pull_request) Successful in 3m57s
e2e-tests / files-changed (pull_request) Successful in 3m9s
db-tests / test-pgsql (pull_request) Failing after 3m26s
db-tests / test-sqlite (pull_request) Failing after 3m39s
db-tests / test-mysql (pull_request) Failing after 8m16s
docker-dryrun / container-amd64 (pull_request) Has been skipped
docker-dryrun / container-arm64 (pull_request) Has been skipped
docker-dryrun / container-riscv64 (pull_request) Has been skipped
db-tests / test-mssql (pull_request) Failing after 7m59s
compliance / lint-on-demand (pull_request) Successful in 2m33s
compliance / lint-go-windows (pull_request) Failing after 3m9s
compliance / lint-go-gogit (pull_request) Failing after 3m12s
compliance / frontend (pull_request) Has been skipped
compliance / checks-backend (pull_request) Failing after 3m5s
compliance / backend (pull_request) Failing after 2m55s
e2e-tests / test-e2e (pull_request) Failing after 3m3s
db-tests / test-unit (pull_request) Failing after 28m41s
compliance / lint-backend (pull_request) Failing after 55m37s
e50e8ed851
- Add HELP_URL and SUPPORT_URL settings to app.ini (defaults to docs.gitea.com)
- Replace hardcoded docs.gitea.com in navbar with configurable HelpURL
- Expose HelpURL/SupportURL template functions
- Show Help URL and Support URL in Site Admin > Configuration
- Add locale strings for new admin config entries
- Create VERSION file (gitignored) for local builds with 1261.0.0 convention

The 1261.xx.xx version convention marks the fork starting point from
upstream Gitea. Set via VERSION file locally or GITEA_VERSION env in CI.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
jmiller merged commit 71105345ff into dev 2026-05-12 20:24:15 +00:00
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: MokoConsulting/MokoGitea#72