github.com/nektos/act@v0.2.63/pkg/model/step_result.go (about)

     1  package model
     2  
     3  import "fmt"
     4  
     5  type stepStatus int
     6  
     7  const (
     8  	StepStatusSuccess stepStatus = iota
     9  	StepStatusFailure
    10  	StepStatusSkipped
    11  )
    12  
    13  var stepStatusStrings = [...]string{
    14  	"success",
    15  	"failure",
    16  	"skipped",
    17  }
    18  
    19  func (s stepStatus) MarshalText() ([]byte, error) {
    20  	return []byte(s.String()), nil
    21  }
    22  
    23  func (s *stepStatus) UnmarshalText(b []byte) error {
    24  	str := string(b)
    25  	for i, name := range stepStatusStrings {
    26  		if name == str {
    27  			*s = stepStatus(i)
    28  			return nil
    29  		}
    30  	}
    31  	return fmt.Errorf("invalid step status %q", str)
    32  }
    33  
    34  func (s stepStatus) String() string {
    35  	if int(s) >= len(stepStatusStrings) {
    36  		return ""
    37  	}
    38  	return stepStatusStrings[s]
    39  }
    40  
    41  type StepResult struct {
    42  	Outputs    map[string]string `json:"outputs"`
    43  	Conclusion stepStatus        `json:"conclusion"`
    44  	Outcome    stepStatus        `json:"outcome"`
    45  }