(t *testing.T)
| 14 | ) |
| 15 | |
| 16 | func TestFindRunnableWorkflows(t *testing.T) { |
| 17 | // Create a temporary directory for test workflows |
| 18 | tempDir := t.TempDir() |
| 19 | workflowsDir := filepath.Join(tempDir, ".github", "workflows") |
| 20 | require.NoError(t, os.MkdirAll(workflowsDir, 0755)) |
| 21 | |
| 22 | // Create test workflow files |
| 23 | tests := []struct { |
| 24 | name string |
| 25 | mdContent string |
| 26 | lockContent string |
| 27 | shouldFind bool |
| 28 | }{ |
| 29 | { |
| 30 | name: "workflow-dispatch.md", |
| 31 | mdContent: `--- |
| 32 | on: |
| 33 | workflow_dispatch: |
| 34 | --- |
| 35 | # Test Workflow with workflow_dispatch |
| 36 | `, |
| 37 | lockContent: `name: "Test Workflow" |
| 38 | on: |
| 39 | workflow_dispatch: |
| 40 | jobs: |
| 41 | test: |
| 42 | runs-on: ubuntu-latest |
| 43 | steps: |
| 44 | - run: echo "test" |
| 45 | `, |
| 46 | shouldFind: true, |
| 47 | }, |
| 48 | { |
| 49 | name: "schedule.md", |
| 50 | mdContent: `--- |
| 51 | on: |
| 52 | schedule: |
| 53 | - cron: "0 0 * * *" |
| 54 | --- |
| 55 | # Test Workflow with schedule |
| 56 | `, |
| 57 | lockContent: `name: "Test Workflow" |
| 58 | on: |
| 59 | schedule: |
| 60 | - cron: "0 0 * * *" |
| 61 | workflow_dispatch: |
| 62 | jobs: |
| 63 | test: |
| 64 | runs-on: ubuntu-latest |
| 65 | steps: |
| 66 | - run: echo "test" |
| 67 | `, |
| 68 | shouldFind: true, |
| 69 | }, |
| 70 | { |
| 71 | name: "push-only.md", |
| 72 | mdContent: `--- |
| 73 | on: |
nothing calls this directly
no test coverage detected