(t *testing.T)
| 142 | } |
| 143 | |
| 144 | func TestValidateActionYml(t *testing.T) { |
| 145 | tests := []struct { |
| 146 | name string |
| 147 | actionYmlContent string |
| 148 | expectError bool |
| 149 | errorContains string |
| 150 | }{ |
| 151 | { |
| 152 | name: "valid node20 action", |
| 153 | actionYmlContent: `name: Test Action |
| 154 | description: A test action |
| 155 | runs: |
| 156 | using: 'node20' |
| 157 | main: 'index.js'`, |
| 158 | expectError: false, |
| 159 | }, |
| 160 | { |
| 161 | name: "valid composite action", |
| 162 | actionYmlContent: `name: Test Action |
| 163 | description: A test action |
| 164 | runs: |
| 165 | using: 'composite' |
| 166 | steps: |
| 167 | - run: echo "test"`, |
| 168 | expectError: false, |
| 169 | }, |
| 170 | { |
| 171 | name: "missing action.yml", |
| 172 | expectError: true, |
| 173 | errorContains: "action.yml not found", |
| 174 | }, |
| 175 | { |
| 176 | name: "missing name field", |
| 177 | actionYmlContent: `description: A test action |
| 178 | runs: |
| 179 | using: 'node20'`, |
| 180 | expectError: true, |
| 181 | errorContains: "missing required field 'name'", |
| 182 | }, |
| 183 | { |
| 184 | name: "missing description field", |
| 185 | actionYmlContent: `name: Test Action |
| 186 | runs: |
| 187 | using: 'node20'`, |
| 188 | expectError: true, |
| 189 | errorContains: "missing required field 'description'", |
| 190 | }, |
| 191 | { |
| 192 | name: "missing runs field", |
| 193 | actionYmlContent: `name: Test Action |
| 194 | description: A test action`, |
| 195 | expectError: true, |
| 196 | errorContains: "missing required field 'runs'", |
| 197 | }, |
| 198 | { |
| 199 | name: "valid node24 action", |
| 200 | actionYmlContent: `name: Test Action |
| 201 | description: A test action |
nothing calls this directly
no test coverage detected