Skip to content

Commit

Permalink
update workflow-tester96
Browse files Browse the repository at this point in the history
  • Loading branch information
GuillaumeFalourd committed May 21, 2024
1 parent e487040 commit fd98d50
Showing 1 changed file with 23 additions and 5 deletions.
28 changes: 23 additions & 5 deletions script.groovy
Original file line number Diff line number Diff line change
@@ -1,7 +1,25 @@
#!groovy
#!/usr/bin/env groovy

sh 'cat Config.json'
def configs = readJSON(file: 'Config.json')
import groovy.json.JsonSlurper

// Read the JSON file
def jsonFile = new File('Config.json')
def jsonSlurper = new JsonSlurper()
def configs = jsonSlurper.parse(jsonFile)

// Calculate the total number of bundles
def totalBundles = configs.bundles.size()
println "Total Array Size =" + totalBundles
def productName = new Object[totalBundles]
println "Total Array Size = " + totalBundles

// Initialize an array for product names
def productName = new Object[totalBundles]

// Example to fill the array (assuming 'bundles' contains objects with a 'name' property)
configs.bundles.eachWithIndex { bundle, index ->
productName[index] = bundle.product.name
}

// Print the product names
productName.each { name ->
println "Product Name: " + name
}

0 comments on commit fd98d50

Please sign in to comment.