fix: add-matcher fails github workflow (#1532)
* fix: add-matcher fails github workflow * make linter happy
This commit is contained in:
parent
3f3b25ae84
commit
8b4f210872
2 changed files with 35 additions and 29 deletions
31
pkg/runner/command.go
Executable file → Normal file
31
pkg/runner/command.go
Executable file → Normal file
|
@ -16,22 +16,27 @@ func init() {
|
||||||
commandPatternADO = regexp.MustCompile("^##\\[([^ ]+)( (.+))?]([^\r\n]*)[\r\n]+$")
|
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 {
|
func (rc *RunContext) commandHandler(ctx context.Context) common.LineHandler {
|
||||||
logger := common.Logger(ctx)
|
logger := common.Logger(ctx)
|
||||||
resumeCommand := ""
|
resumeCommand := ""
|
||||||
return func(line string) bool {
|
return func(line string) bool {
|
||||||
var command string
|
command, kvPairs, arg, ok := tryParseRawActionCommand(line)
|
||||||
var kvPairs map[string]string
|
if !ok {
|
||||||
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 {
|
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -66,6 +71,8 @@ func (rc *RunContext) commandHandler(ctx context.Context) common.LineHandler {
|
||||||
case "save-state":
|
case "save-state":
|
||||||
logger.Infof(" \U0001f4be %s", line)
|
logger.Infof(" \U0001f4be %s", line)
|
||||||
rc.saveState(ctx, kvPairs, arg)
|
rc.saveState(ctx, kvPairs, arg)
|
||||||
|
case "add-matcher":
|
||||||
|
logger.Infof(" \U00002753 add-matcher %s", arg)
|
||||||
default:
|
default:
|
||||||
logger.Infof(" \U00002753 %s", line)
|
logger.Infof(" \U00002753 %s", line)
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,23 +9,22 @@ inputs:
|
||||||
runs:
|
runs:
|
||||||
using: "composite"
|
using: "composite"
|
||||||
steps:
|
steps:
|
||||||
# The output of actions/setup-node@v2 seems to fail the workflow
|
- uses: actions/setup-node@v3
|
||||||
# - uses: actions/setup-node@v2
|
with:
|
||||||
# with:
|
node-version: '16'
|
||||||
# node-version: '16'
|
- run: |
|
||||||
# - run: |
|
console.log(process.version);
|
||||||
# console.log(process.version);
|
console.log("Hi from node");
|
||||||
# console.log("Hi from node");
|
console.log("${{ inputs.test_input_optional }}");
|
||||||
# console.log("${{ inputs.test_input_optional }}");
|
if("${{ inputs.test_input_optional }}" !== "Test") {
|
||||||
# if("${{ inputs.test_input_optional }}" !== "Test") {
|
console.log("Invalid input test_input_optional expected \"Test\" as value");
|
||||||
# console.log("Invalid input test_input_optional expected \"Test\" as value");
|
process.exit(1);
|
||||||
# process.exit(1);
|
}
|
||||||
# }
|
if(!process.version.startsWith('v16')) {
|
||||||
# if(!process.version.startsWith('v16')) {
|
console.log("Expected node v16, but got " + process.version);
|
||||||
# console.log("Expected node v16, but got " + process.version);
|
process.exit(1);
|
||||||
# process.exit(1);
|
}
|
||||||
# }
|
shell: node {0}
|
||||||
# shell: node {0}
|
|
||||||
- uses: ./uses-composite/composite_action
|
- uses: ./uses-composite/composite_action
|
||||||
id: composite
|
id: composite
|
||||||
with:
|
with:
|
||||||
|
|
Loading…
Reference in a new issue