Skip to content

Commit 13795cb

Browse files
committed
feat: allow passing custom directory as argument
1 parent 9e323fc commit 13795cb

1 file changed

Lines changed: 8 additions & 12 deletions

File tree

.github/actions/update-plugin-index/index-plugins.groovy

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -549,23 +549,19 @@ class Utils {
549549
}
550550
}
551551

552-
def specificPluginFile = (args && args.length > 0) ? new File(args[0]) : null
553-
if (specificPluginFile) {
554-
if (!specificPluginFile.exists() || !specificPluginFile.isFile()) {
555-
System.err.println("ERROR: Specified file '$specificPluginFile.path' does not exist or is not a file")
556-
System.exit(1)
557-
}
558-
Utils.processPluginFile(specificPluginFile)
559-
println("Processed single file: $specificPluginFile.path")
552+
def fileArg = (args && args.length > 0) ? new File(args[0]) : 'grails-plugins' as File
553+
554+
if (fileArg.file) {
555+
Utils.processPluginFile(fileArg)
556+
println("Processed single file: $fileArg.path")
560557
}
561558
else {
562-
def rootDir = 'grails-plugins' as File
563-
if (!rootDir.exists() || !rootDir.directory) {
564-
System.err.println("ERROR: Directory 'grails-plugins' not found in ${('.' as File).absolutePath}")
559+
if (!fileArg.exists() || !fileArg.directory) {
560+
System.err.println("ERROR: Directory '$fileArg.path' not found in ${('.' as File).absolutePath}")
565561
System.exit(1)
566562
}
567563
List<Map> indexEntries = []
568-
rootDir.eachFileRecurse(FileType.FILES) { f ->
564+
fileArg.eachFileRecurse(FileType.FILES) { f ->
569565
def pluginInfo = Utils.processPluginFile(f)
570566
// Add to index (include everything from YAML)
571567
if (pluginInfo) {

0 commit comments

Comments
 (0)