33 lines
981 B
Go
33 lines
981 B
Go
package app
|
|
|
|
import (
|
|
"gitea.maximumdirect.net/eric/distributor/internal/notify"
|
|
"gitea.maximumdirect.net/eric/distributor/internal/publish"
|
|
)
|
|
|
|
func shouldNotify(action publish.Action) bool {
|
|
return action == publish.ActionPublishNew || action == publish.ActionUpsertAdditive || action == publish.ActionReplaceCatalog || action == publish.ActionForceReplace
|
|
}
|
|
|
|
func notifyEvent(plan publish.Plan) notify.Event {
|
|
outputs := make([]notify.Output, 0, len(plan.Outputs))
|
|
for _, output := range plan.Outputs {
|
|
outputs = append(outputs, notify.Output{
|
|
Path: output.DestinationPath,
|
|
Kind: output.Kind,
|
|
SourcePath: output.SourcePath,
|
|
Transform: output.Transform,
|
|
SHA256: output.SHA256,
|
|
Size: output.Size,
|
|
})
|
|
}
|
|
return notify.Event{
|
|
PipelineID: plan.PipelineID,
|
|
DestinationID: plan.DestinationID,
|
|
BundleID: plan.BundleID,
|
|
BundlePath: plan.BundlePath,
|
|
Action: string(plan.Action),
|
|
Outputs: outputs,
|
|
}
|
|
}
|