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

Function TestIsRunnable_RealWorldScenario

pkg/cli/run_workflow_validation_test.go:341–386  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

339}
340
341func TestIsRunnable_RealWorldScenario(t *testing.T) {
342 // This test simulates the real-world scenario from the issue:
343 // A workflow with "on: daily" in the .md file gets compiled to
344 // include workflow_dispatch in the .lock.yml file
345 tmpDir := t.TempDir()
346 markdownPath := filepath.Join(tmpDir, "daily-issues-report.md")
347 lockPath := getLockFilePath(markdownPath)
348
349 // Create markdown file with shorthand trigger
350 markdownContent := `---
351description: Daily report
352on: daily
353permissions:
354 contents: read
355engine: codex
356---
357
358# Daily Issues Report
359`
360 err := os.WriteFile(markdownPath, []byte(markdownContent), 0644)
361 require.NoError(t, err)
362
363 // Create lock file with expanded triggers (as the compiler would do)
364 lockContent := `name: "Daily Issues Report Generator"
365on:
366 schedule:
367 - cron: "10 16 * * *"
368 workflow_dispatch:
369
370permissions:
371 contents: read
372
373jobs:
374 agent:
375 runs-on: ubuntu-latest
376 steps:
377 - run: echo "test"
378`
379 err = os.WriteFile(lockPath, []byte(lockContent), 0644)
380 require.NoError(t, err)
381
382 // Test that the workflow is runnable
383 runnable, err := IsRunnable(markdownPath)
384 require.NoError(t, err, "Should not error when checking compiled workflow")
385 assert.True(t, runnable, "Workflow should be runnable because lock file has workflow_dispatch")
386}
387
388func TestValidateWorkflowInputs_WithLockFile(t *testing.T) {
389 // This test ensures validateWorkflowInputs still works with lock files

Callers

nothing calls this directly

Calls 2

getLockFilePathFunction · 0.85
IsRunnableFunction · 0.85

Tested by

no test coverage detected