(t *testing.T)
| 39 | } |
| 40 | |
| 41 | func TestIsRunnable_WithLockFile(t *testing.T) { |
| 42 | tests := []struct { |
| 43 | name string |
| 44 | markdownFile string |
| 45 | lockFileYAML string |
| 46 | expectRunnable bool |
| 47 | expectError bool |
| 48 | errorContains string |
| 49 | }{ |
| 50 | { |
| 51 | name: "workflow with workflow_dispatch trigger", |
| 52 | markdownFile: "test-workflow.md", |
| 53 | lockFileYAML: `name: "Test Workflow" |
| 54 | on: |
| 55 | workflow_dispatch: |
| 56 | permissions: |
| 57 | contents: read |
| 58 | jobs: |
| 59 | test: |
| 60 | runs-on: ubuntu-latest |
| 61 | steps: |
| 62 | - run: echo "test" |
| 63 | `, |
| 64 | expectRunnable: true, |
| 65 | expectError: false, |
| 66 | }, |
| 67 | { |
| 68 | name: "workflow with schedule and workflow_dispatch", |
| 69 | markdownFile: "daily-workflow.md", |
| 70 | lockFileYAML: `name: "Daily Workflow" |
| 71 | on: |
| 72 | schedule: |
| 73 | - cron: "0 0 * * *" |
| 74 | workflow_dispatch: |
| 75 | permissions: |
| 76 | contents: read |
| 77 | jobs: |
| 78 | test: |
| 79 | runs-on: ubuntu-latest |
| 80 | steps: |
| 81 | - run: echo "test" |
| 82 | `, |
| 83 | expectRunnable: true, |
| 84 | expectError: false, |
| 85 | }, |
| 86 | { |
| 87 | name: "workflow without workflow_dispatch", |
| 88 | markdownFile: "pr-workflow.md", |
| 89 | lockFileYAML: `name: "PR Workflow" |
| 90 | on: |
| 91 | pull_request: |
| 92 | types: [opened] |
| 93 | permissions: |
| 94 | contents: read |
| 95 | jobs: |
| 96 | test: |
| 97 | runs-on: ubuntu-latest |
| 98 | steps: |
nothing calls this directly
no test coverage detected