@@ -221,29 +221,33 @@ func (l *Linter) debugWriter() io.Writer {
221
221
return l .logOut
222
222
}
223
223
224
- // GenerateDefaultConfig generates default config file at ".github/actionlint.yaml" in project
224
+ // GenerateDefaultConfig generates default config file at ".github/actionlint.yaml" in the project
225
225
// which the given directory path belongs to.
226
226
func (l * Linter ) GenerateDefaultConfig (dir string ) error {
227
227
l .log ("Generating default actionlint.yaml in repository:" , dir )
228
228
229
- p , err := l .projects .At (dir )
229
+ proj , err := l .projects .At (dir )
230
230
if err != nil {
231
231
return err
232
232
}
233
- if p == nil {
233
+ if proj == nil {
234
234
return errors .New ("project is not found. check current project is initialized as Git repository and \" .github/workflows\" directory exists" )
235
235
}
236
236
237
- path := filepath .Join (p .RootDir (), ".github" , "actionlint.yaml" )
238
- if _ , err := os .Stat (path ); err == nil {
239
- return fmt .Errorf ("config file already exists at %q" , path )
237
+ d := filepath .Join (proj .RootDir (), ".github" )
238
+ for _ , f := range []string {"actionlint.yaml" , "actionlint.yml" } {
239
+ p := filepath .Join (d , f )
240
+ if _ , err := os .Stat (p ); err == nil {
241
+ return fmt .Errorf ("config file already exists at %q" , p )
242
+ }
240
243
}
241
244
242
- if err := writeDefaultConfigFile (path ); err != nil {
245
+ p := filepath .Join (d , "actionlint.yaml" )
246
+ if err := writeDefaultConfigFile (p ); err != nil {
243
247
return err
244
248
}
245
249
246
- fmt .Fprintf (l .out , "Config file was generated at %q\n " , path )
250
+ fmt .Fprintf (l .out , "Config file was generated at %q\n " , p )
247
251
return nil
248
252
}
249
253
0 commit comments