MCPcopy Create free account
hub / github.com/github/gh-aw / TestFindRunnableWorkflows_WithInputs

Function TestFindRunnableWorkflows_WithInputs

pkg/cli/run_interactive_test.go:293–362  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

291}
292
293func TestFindRunnableWorkflows_WithInputs(t *testing.T) {
294 // Create a temporary directory for test workflows
295 tempDir := t.TempDir()
296 workflowsDir := filepath.Join(tempDir, ".github", "workflows")
297 require.NoError(t, os.MkdirAll(workflowsDir, 0755))
298
299 // Create workflow with inputs (markdown file)
300 workflowContent := `---
301on:
302 workflow_dispatch:
303 inputs:
304 name:
305 description: 'Name input'
306 required: true
307 type: string
308 optional:
309 description: 'Optional input'
310 required: false
311 type: string
312 default: 'default-value'
313---
314# Test Workflow with inputs
315`
316
317 workflowPath := filepath.Join(workflowsDir, "test-inputs.md")
318 require.NoError(t, os.WriteFile(workflowPath, []byte(workflowContent), 0600))
319
320 // Create corresponding lock file
321 lockContent := `name: "Test Workflow"
322on:
323 workflow_dispatch:
324 inputs:
325 name:
326 description: 'Name input'
327 required: true
328 type: string
329 optional:
330 description: 'Optional input'
331 required: false
332 type: string
333 default: 'default-value'
334jobs:
335 test:
336 runs-on: ubuntu-latest
337 steps:
338 - run: echo "test"
339`
340 lockPath := filepath.Join(workflowsDir, "test-inputs.lock.yml")
341 require.NoError(t, os.WriteFile(lockPath, []byte(lockContent), 0600))
342
343 // Change to temp directory
344 oldWd, err := os.Getwd()
345 require.NoError(t, err)
346 defer func() { _ = os.Chdir(oldWd) }()
347 require.NoError(t, os.Chdir(tempDir))
348
349 // Find runnable workflows
350 workflows, err := findRunnableWorkflows(false)

Callers

nothing calls this directly

Calls 1

findRunnableWorkflowsFunction · 0.85

Tested by

no test coverage detected