orgFromLocalState reads the organization from the local attestation state file. Returns empty string on any error (file not found, parse error, etc.).
(customPath string)
| 91 | // orgFromLocalState reads the organization from the local attestation state file. |
| 92 | // Returns empty string on any error (file not found, parse error, etc.). |
| 93 | func orgFromLocalState(customPath string) string { |
| 94 | raw, err := os.ReadFile(action.AttestationStatePath(customPath)) |
| 95 | if err != nil { |
| 96 | return "" |
| 97 | } |
| 98 | |
| 99 | state := &crafter.VersionedCraftingState{CraftingState: &v1.CraftingState{}} |
| 100 | if err := protojson.Unmarshal(raw, state); err != nil { |
| 101 | return "" |
| 102 | } |
| 103 | |
| 104 | return state.GetAttestation().GetWorkflow().GetOrganization() |
| 105 | } |
| 106 | |
| 107 | // extractAnnotations extracts the annotations from the flag and returns a map |
| 108 | // the expected input format is key=value |