mirror of
https://gitea.com/gitea/runner.git
synced 2026-11-06 07:10:28 +00:00
Support Simplified Concurrency (#139)
- update RawConcurrency struct to parse and serialize string-based concurrency notation - update EvaluateConcurrency to handle new RawConcurrency format Reviewed-on: https://gitea.com/gitea/act/pulls/139 Reviewed-by: Zettat123 <[email protected]> Reviewed-by: Lunny Xiao <[email protected]> Co-authored-by: ChristopherHX <[email protected]> Co-committed-by: ChristopherHX <[email protected]>
This commit is contained in:
1 parent
9924aea786
commit
39509e9ad0
2 files changed
+33
-3
No files matched your search
@@ -778,4 +778,22 @@ func decodeNode(node yaml.Node, out interface{}) bool {
|
||||
type RawConcurrency struct {
|
||||
Group string `yaml:"group,omitempty"`
|
||||
CancelInProgress string `yaml:"cancel-in-progress,omitempty"`
|
||||
RawExpression string `yaml:"-,omitempty"`
|
||||
}
|
||||
|
||||
type objectConcurrency RawConcurrency
|
||||
|
||||
func (r *RawConcurrency) UnmarshalYAML(n *yaml.Node) error {
|
||||
if err := n.Decode(&r.RawExpression); err == nil {
|
||||
return nil
|
||||
}
|
||||
return n.Decode((*objectConcurrency)(r))
|
||||
}
|
||||
|
||||
func (r *RawConcurrency) MarshalYAML() (interface{}, error) {
|
||||
if r.RawExpression != "" {
|
||||
return r.RawExpression, nil
|
||||
}
|
||||
|
||||
return (*objectConcurrency)(r), nil
|
||||
}
|
||||
Reference in new issue
Block a user