Org default teams: add Protected option + bot-account naming/auto-membership follow-ups (#513) #745
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Follow-ups discovered while reviewing the auto-created default org teams (#513). None are bugs in shipped behavior — these are enhancements to decide on later.
Current state (verified in code)
models/organization/org.go:338DefaultOrgTeams): Developers (write), Reviewers (read), CI/CD (actions+packages write). Plus the built-in Owners team.Ownersis protected —IsOwnerTeam()(models/organization/team.go) blocks its deletion. Developers/Reviewers/CI/CD are ordinary teams — an org owner can rename or delete them.DefaultTeamSpechas no protection field.AddTeamMemberfor the actions/api bot in the creation flow).models/user/user_system.go): namemokogitea-actions, id-2, emailmokogitea-actions[bot]@mokoconsulting.tech, FullName "MokoGitea Actions". Legacy reserved names:gitea-actions,github-actions.Proposed work
1.
Protectedoption on default teamsAdd a
Protected bool(orCanBeDeleted) field toDefaultTeamSpecand enforce it at the team delete/rename choke point (extend the guard beyondIsOwnerTeam), so a chosen default team (e.g. CI/CD or a future Bots team) can be made undeletable/unrenamable like Owners. Consider a matchingis_protectedflag on the team model + migration if it needs to persist per-team.2. Bot account naming (the "bots rename")
Confirm/standardize the bot account naming convention. Current is
mokogitea-actions; decide whether it should bemokogitea[bot]/mokogitea-actions[bot]as the actual username (note:[/]are not normally valid Gitea usernames — GitHub'sgithub-actions[bot]is a special-cased login, so this may need special handling), and whether a separate API/automation bot account is wanted distinct from the actions user (-2).3. Auto-add the bot to a team (optional)
Optionally auto-add the actions/api bot to the CI/CD (or a new Bots) team on org creation, so automation has team-scoped access out of the box.
4. A dedicated
Botsteam (optional)Whether to add a Bots default team (or rename CI/CD → Bots) for service/automation accounts — and if so, make it Protected (depends on #1).
Related: #513 (default teams), #727 org-governance series.
https://claude.ai/code/session_01Wsno14cxE49MstXFs9G5KT
Branch created:
feature/745-org-default-teams-add-protected-option-b