vole
Clone
Read only, no credentials:
https://rodent.software/vole.git
Write over SSH with a registered key:
git clone ssh://git@rodent.software:2222/vole.git
A free and open-source forge that lives in your Git repo.
Filter workflow events by mentions and assignment
727df38613897e6ffd56e1df05a2f674174bf547 · Keenan Nemetz · 8d ago · parent eb07ff56
Filter workflow events by mentions and assignment Add mentioned, replied-to, assigned-to, and author filters to issue, comment, and change-request triggers. Move the role vocabulary into core/role so author.role is validated without importing the access store, and pin mentions, reply authors, and assignee changes in the event payload.
forge/access/acl.go +12−37
| @@ -7,49 +7,24 @@ import ( | |||
| 7 | 7 | "fmt" | |
| 8 | 8 | "sort" | |
| 9 | 9 | "strings" | |
| 10 | |||
| 11 | "github.com/rodent-software/vole/core/role" | ||
| 10 | 12 | ) | |
| 11 | 13 | ||
| 12 | type Role int | ||
| 14 | // Role is the ordered access role. The vocabulary lives in core/role so a | ||
| 15 | // workflow can validate an author role without importing the access store. | ||
| 16 | type Role = role.Role | ||
| 13 | 17 | ||
| 14 | 18 | const ( | |
| 15 | None Role = iota | ||
| 16 | Read | ||
| 17 | Contribute | ||
| 18 | Maintain | ||
| 19 | Admin | ||
| 19 | None = role.None | ||
| 20 | Read = role.Read | ||
| 21 | Contribute = role.Contribute | ||
| 22 | Maintain = role.Maintain | ||
| 23 | Admin = role.Admin | ||
| 20 | 24 | ) | |
| 21 | 25 | ||
| 22 | func ParseRole(s string) (Role, error) { | ||
| 23 | switch strings.ToLower(strings.TrimSpace(s)) { | ||
| 24 | case "", "none": | ||
| 25 | return None, nil | ||
| 26 | case "read": | ||
| 27 | return Read, nil | ||
| 28 | case "contribute", "contributor", "contrib": | ||
| 29 | return Contribute, nil | ||
| 30 | case "maintain", "maintainer", "write": | ||
| 31 | // "write" is the historical spelling. Existing ACL rows and scripts keep | ||
| 32 | // working; new entries are written as "maintain". | ||
| 33 | return Maintain, nil | ||
| 34 | case "admin", "owner": | ||
| 35 | return Admin, nil | ||
| 36 | } | ||
| 37 | return None, fmt.Errorf("unknown role %q (want none, read, contribute, maintain or admin)", s) | ||
| 38 | } | ||
| 39 | func (r Role) String() string { | ||
| 40 | switch r { | ||
| 41 | case Read: | ||
| 42 | return "read" | ||
| 43 | case Contribute: | ||
| 44 | return "contribute" | ||
| 45 | case Maintain: | ||
| 46 | return "maintain" | ||
| 47 | case Admin: | ||
| 48 | return "admin" | ||
| 49 | } | ||
| 50 | return "none" | ||
| 51 | } | ||
| 52 | func (r Role) AtLeast(need Role) bool { return r >= need } | ||
| 26 | // ParseRole keeps the historical call shape. | ||
| 27 | func ParseRole(s string) (Role, error) { return role.Parse(s) } | ||
| 53 | 28 | ||
| 54 | 29 | // Write is the historical name for Maintain. It stays so external code using the | |
| 55 | 30 | // access package, and ACL rows written before the rename, keep compiling and | |