/
githubmirror
/
act
Обзор
Документация
Войти
/
githubmirror
/
act
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
pkg/model/step_result.go
45 строк
822 B
ChristopherHX
refactor: fix savestate in pre steps (#1466)
15 дек 2022, 20:08
Не верифицирован
15 дек 2022, 20:08
b8d7e94
Код
Авторство
О чём код?
package model import "fmt" type stepStatus int const ( StepStatusSuccess stepStatus = iota StepStatusFailure StepStatusSkipped ) var stepStatusStrings = [...]string{ "success", "failure", "skipped", } func (s stepStatus) MarshalText() ([]byte, error) { return []byte(s.String()), nil } func (s *stepStatus) UnmarshalText(b []byte) error { str := string(b) for i, name := range stepStatusStrings { if name == str { *s = stepStatus(i) return nil } } return fmt.Errorf("invalid step status %q", str) } func (s stepStatus) String() string { if int(s) >= len(stepStatusStrings) { return "" } return stepStatusStrings[s] } type StepResult struct { Outputs map[string]string `json:"outputs"` Conclusion stepStatus `json:"conclusion"` Outcome stepStatus `json:"outcome"` }