1
0
Fork 0
mirror of https://code.forgejo.org/forgejo/runner.git synced 2025-09-15 18:57:01 +00:00

fix(jobparser): support workflow_call.inputs and workflow_call.outputs (#70)

- Closes #69
- #45
- https://codeberg.org/forgejo/forgejo/issues/6069

Reviewed-on: https://code.forgejo.org/forgejo/act/pulls/70
Reviewed-by: earl-warren <earl-warren@noreply.code.forgejo.org>
Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
Co-committed-by: Michael Kriese <michael.kriese@visualon.de>
This commit is contained in:
Michael Kriese 2025-01-29 08:38:30 +00:00 committed by Michael Kriese
parent 0e99df94b7
commit 54fead51c6
2 changed files with 23 additions and 2 deletions

View file

@ -260,7 +260,7 @@ func ParseRawOn(rawOn *yaml.Node) ([]*Event, error) {
}
}
case map[string]interface{}:
if k != "workflow_dispatch" || act != "inputs" {
if isInvalidOnType(k, act) {
return nil, fmt.Errorf("unknown on type: %#v", v)
}
acts = nil
@ -304,6 +304,16 @@ func ParseRawOn(rawOn *yaml.Node) ([]*Event, error) {
}
}
func isInvalidOnType(onType, subKey string) bool {
if onType == "workflow_dispatch" && subKey == "inputs" {
return false
}
if onType == "workflow_call" && (subKey == "inputs" || subKey == "outputs") {
return false
}
return true
}
// parseMappingNode parse a mapping node and preserve order.
func parseMappingNode[T any](node *yaml.Node) ([]string, []T, error) {
if node.Kind != yaml.MappingNode {