Auto-add the actions bot to the CI/CD team on org creation (#513) #746
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?
Firms up #745 §3 into a concrete requirement: when a new organization is created, the actions/automation bot should be auto-added as a member of the CI/CD team so automation has team-scoped access out of the box (today the CI/CD team is created empty).
Implementation
CreateOrganization(models/organization/org.go, afterDefaultOrgTeamsare inserted ~lines 471–496), once the CI/CD team exists, add the actions bot to it.mokogitea-actions/ActionsUserID = -2(models/user/user_system.go). Use its user record (user_model.NewActionsUser()/ fetch by id -2).Important considerations / gotchas
AddTeamMembermay not currently accept the system user (id -2, negative id,IsActive/type differences). Verify it does, or add a code path that adds the bot without the normal member validations. A system user is not a normal org member.AddTeamMemberchoke point (services/org/team.go→ErrEmailDomainNotAllowed). The bot's email ismokogitea-actions[bot]@mokoconsulting.tech; if an org sets an email-domain policy that excludesmokoconsulting.tech, auto-adding the bot would be rejected. The auto-add must bypass the email-domain check for the system bot (system users are exempt), or add the bot before/around that enforcement. This is the key correctness detail.Acceptance
mokogitea-actionsbot as a member.Related: #745 (parent — teams/bots follow-ups), #513 (default teams), #732 (email-domain policy), #727 (org-governance).
https://claude.ai/code/session_01Wsno14cxE49MstXFs9G5KT
Branch created:
feature/746-auto-add-the-actions-bot-to-the-ci-cd-te