DLV-FB1 sdk: a forge message says a branch was deleted (design 51 *Tagged versions*)
delivery.ForgeBranchDeleted, accepted by checkForgeKind, names the repository and the branch and carries nothing else (A3's request 2). Claude-Session: https://claude.ai/code/session_01JG73KJNrH5EgFXMKKYSrig
This commit is contained in:
+14
-2
@@ -47,6 +47,10 @@ const (
|
||||
ForgeMerged = "merged"
|
||||
ForgeRefused = "refused"
|
||||
ForgeOpen = "open"
|
||||
// ForgeBranchDeleted says a branch of a repository was deleted on the forge, from the forge's own delete event
|
||||
// (design 51 *Tagged versions*): the builder removes the tagged versions it asked for that branch. It names the
|
||||
// repository and the branch and carries nothing else. A reader that does not know the kind ignores it.
|
||||
ForgeBranchDeleted = "branch-deleted"
|
||||
)
|
||||
|
||||
// OpenPull names an open pull request into the trunk: the repository as `<owner>/<name>` and the number.
|
||||
@@ -166,10 +170,10 @@ func checkRepository(repository string) error {
|
||||
|
||||
func checkForgeKind(kind string) error {
|
||||
switch kind {
|
||||
case ForgePull, ForgeMerged, ForgeRefused, ForgeOpen:
|
||||
case ForgePull, ForgeMerged, ForgeRefused, ForgeOpen, ForgeBranchDeleted:
|
||||
return nil
|
||||
}
|
||||
return fmt.Errorf("delivery: the forge kind %q is not pull, merged, refused or open", kind)
|
||||
return fmt.Errorf("delivery: the forge kind %q is not pull, merged, refused, open or branch-deleted", kind)
|
||||
}
|
||||
|
||||
// ForgeEvent is the name of a forge message of the given kind: `forge.<owner>.<name>.<kind>`.
|
||||
@@ -704,6 +708,14 @@ func (f Forge) check() error {
|
||||
if err := f.checkInputs(func(d string) bool { _, ok := f.Trees[d]; return ok }, "its trees"); err != nil {
|
||||
return err
|
||||
}
|
||||
case ForgeBranchDeleted:
|
||||
if f.Branch == "" {
|
||||
return fmt.Errorf("delivery: a branch-deleted message needs the branch")
|
||||
}
|
||||
if f.Number != 0 || f.Head != "" || f.Merge != "" || len(f.Dirs) > 0 || len(f.Trees) > 0 || len(f.Manifests) > 0 ||
|
||||
len(f.Locks) > 0 || len(f.Paths) > 0 || len(f.Packages) > 0 || f.Act != "" {
|
||||
return fmt.Errorf("delivery: a branch-deleted message names its repository and branch and carries nothing else")
|
||||
}
|
||||
case ForgeRefused:
|
||||
if len(f.Dirs) > 0 || f.DirsKnown {
|
||||
return fmt.Errorf("delivery: a refused message carries no module directories")
|
||||
|
||||
Reference in New Issue
Block a user