extractInputs extracts input parameters from core.getInput() calls
(content string)
| 214 | |
| 215 | // extractInputs extracts input parameters from core.getInput() calls |
| 216 | func extractInputs(content string) []ActionInput { |
| 217 | var inputs []ActionInput |
| 218 | seen := make(map[string]struct { |
| 219 | }) |
| 220 | |
| 221 | // Match core.getInput('name') or core.getInput("name") |
| 222 | matches := coreGetInputPattern.FindAllStringSubmatch(content, -1) |
| 223 | |
| 224 | for _, match := range matches { |
| 225 | if len(match) > 1 { |
| 226 | inputName := match[1] |
| 227 | if !setutil.Contains(seen, inputName) { |
| 228 | inputs = append(inputs, ActionInput{ |
| 229 | Name: inputName, |
| 230 | Description: "Input parameter: " + inputName, |
| 231 | Required: false, |
| 232 | Default: "", |
| 233 | }) |
| 234 | seen[inputName] = struct { |
| 235 | }{} |
| 236 | } |
| 237 | } |
| 238 | } |
| 239 | |
| 240 | // Sort inputs by name for consistency |
| 241 | slices.SortFunc(inputs, func(a, b ActionInput) int { |
| 242 | switch { |
| 243 | case a.Name < b.Name: |
| 244 | return -1 |
| 245 | case a.Name > b.Name: |
| 246 | return 1 |
| 247 | default: |
| 248 | return 0 |
| 249 | } |
| 250 | }) |
| 251 | |
| 252 | return inputs |
| 253 | } |
| 254 | |
| 255 | // extractOutputs extracts output parameters from core.setOutput() calls |
| 256 | func extractOutputs(content string) []ActionOutput { |