Share typed publication completion evidence
This commit is contained in:
@@ -43,38 +43,12 @@ func committedPublishOutputOutcomes(m *manifest.Manifest) map[string]string {
|
||||
if m == nil || m.Stages["publish"] == nil {
|
||||
return out
|
||||
}
|
||||
raw := m.Stages["publish"].Metadata["publish_output_outcomes"]
|
||||
appendOutcome := func(item map[string]any) {
|
||||
source, sourceOK := item["source"].(string)
|
||||
status, statusOK := item["status"].(string)
|
||||
if sourceOK && statusOK && isPublishOutputOutcome(status) {
|
||||
out[source] = status
|
||||
}
|
||||
}
|
||||
switch items := raw.(type) {
|
||||
case []any:
|
||||
for _, rawItem := range items {
|
||||
if item, ok := rawItem.(map[string]any); ok {
|
||||
appendOutcome(item)
|
||||
}
|
||||
}
|
||||
case []map[string]any:
|
||||
for _, item := range items {
|
||||
appendOutcome(item)
|
||||
}
|
||||
for _, outcome := range artifacts.DecodePublicationOutcomes(m.Stages["publish"].Metadata) {
|
||||
out[outcome.Source] = string(outcome.Status)
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
||||
func isPublishOutputOutcome(status string) bool {
|
||||
switch status {
|
||||
case "published", "carried_locked", "locked_unpublished", "optional_missing", "unselected":
|
||||
return true
|
||||
default:
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
func committedPublishedOutputs(commit *artifacts.RemoteCommitManifest) map[string]artifacts.RemoteArtifact {
|
||||
out := map[string]artifacts.RemoteArtifact{}
|
||||
if commit == nil {
|
||||
|
||||
Reference in New Issue
Block a user