diff --git a/pkg/runner/command.go b/pkg/runner/command.go old mode 100755 new mode 100644 index 0b0ba2f..53e167c --- a/pkg/runner/command.go +++ b/pkg/runner/command.go @@ -16,22 +16,27 @@ func init() { commandPatternADO = regexp.MustCompile("^##\\[([^ ]+)( (.+))?]([^\r\n]*)[\r\n]+$") } +func tryParseRawActionCommand(line string) (command string, kvPairs map[string]string, arg string, ok bool) { + if m := commandPatternGA.FindStringSubmatch(line); m != nil { + command = m[1] + kvPairs = parseKeyValuePairs(m[3], ",") + arg = m[4] + ok = true + } else if m := commandPatternADO.FindStringSubmatch(line); m != nil { + command = m[1] + kvPairs = parseKeyValuePairs(m[3], ";") + arg = m[4] + ok = true + } + return +} + func (rc *RunContext) commandHandler(ctx context.Context) common.LineHandler { logger := common.Logger(ctx) resumeCommand := "" return func(line string) bool { - var command string - var kvPairs map[string]string - var arg string - if m := commandPatternGA.FindStringSubmatch(line); m != nil { - command = m[1] - kvPairs = parseKeyValuePairs(m[3], ",") - arg = m[4] - } else if m := commandPatternADO.FindStringSubmatch(line); m != nil { - command = m[1] - kvPairs = parseKeyValuePairs(m[3], ";") - arg = m[4] - } else { + command, kvPairs, arg, ok := tryParseRawActionCommand(line) + if !ok { return true } @@ -66,6 +71,8 @@ func (rc *RunContext) commandHandler(ctx context.Context) common.LineHandler { case "save-state": logger.Infof(" \U0001f4be %s", line) rc.saveState(ctx, kvPairs, arg) + case "add-matcher": + logger.Infof(" \U00002753 add-matcher %s", arg) default: logger.Infof(" \U00002753 %s", line) } diff --git a/pkg/runner/testdata/uses-nested-composite/composite_action2/action.yml b/pkg/runner/testdata/uses-nested-composite/composite_action2/action.yml index 2fae40c..4aec9a8 100644 --- a/pkg/runner/testdata/uses-nested-composite/composite_action2/action.yml +++ b/pkg/runner/testdata/uses-nested-composite/composite_action2/action.yml @@ -9,23 +9,22 @@ inputs: runs: using: "composite" steps: -# The output of actions/setup-node@v2 seems to fail the workflow -# - uses: actions/setup-node@v2 -# with: -# node-version: '16' -# - run: | -# console.log(process.version); -# console.log("Hi from node"); -# console.log("${{ inputs.test_input_optional }}"); -# if("${{ inputs.test_input_optional }}" !== "Test") { -# console.log("Invalid input test_input_optional expected \"Test\" as value"); -# process.exit(1); -# } -# if(!process.version.startsWith('v16')) { -# console.log("Expected node v16, but got " + process.version); -# process.exit(1); -# } -# shell: node {0} + - uses: actions/setup-node@v3 + with: + node-version: '16' + - run: | + console.log(process.version); + console.log("Hi from node"); + console.log("${{ inputs.test_input_optional }}"); + if("${{ inputs.test_input_optional }}" !== "Test") { + console.log("Invalid input test_input_optional expected \"Test\" as value"); + process.exit(1); + } + if(!process.version.startsWith('v16')) { + console.log("Expected node v16, but got " + process.version); + process.exit(1); + } + shell: node {0} - uses: ./uses-composite/composite_action id: composite with: