(text)
| 43 | } |
| 44 | |
| 45 | function parseInputs(text) { |
| 46 | const lines = text.split(/\r?\n/); |
| 47 | const start = lines.findIndex((line) => /^inputs:\s*$/.test(line)); |
| 48 | assert.ok(start >= 0, "action.yml must define inputs"); |
| 49 | const end = lines.findIndex((line, index) => index > start && /^(outputs|runs):\s*$/.test(line)); |
| 50 | const inputs = {}; |
| 51 | const limit = end >= 0 ? end : lines.length; |
| 52 | |
| 53 | for (let index = start + 1; index < limit; index += 1) { |
| 54 | const match = /^ ([A-Za-z0-9_]+):\s*$/.exec(lines[index]); |
| 55 | if (!match) continue; |
| 56 | const name = match[1]; |
| 57 | let defaultValue; |
| 58 | for (let cursor = index + 1; cursor < limit; cursor += 1) { |
| 59 | if (/^ [A-Za-z0-9_]+:\s*$/.test(lines[cursor])) break; |
| 60 | const defaultMatch = /^ default:\s*(.*)$/.exec(lines[cursor]); |
| 61 | if (defaultMatch) defaultValue = parseScalar(defaultMatch[1]); |
| 62 | } |
| 63 | inputs[name] = { default: defaultValue }; |
| 64 | } |
| 65 | return inputs; |
| 66 | } |
| 67 | |
| 68 | function parseSteps(text) { |
| 69 | const lines = text.split(/\r?\n/); |
no test coverage detected