Groovy stage to actions yml

Here is one of the stage from my groovy script can it be wriiten into actions yml file

stage('builds') {

    String[] changedPackages = changed.replaceAll('"','').split('\n').collect{it as String}

    def stepsForParallel = [:]

    changedPackages.each {

      // ops packages

      if (it.startsWith('@filename1')) {

        build job: "${it.replace('@filename1/', '')}", quietPeriod: 5, wait: false


      // oc plugins

      if (it.startsWith('@filename2')) {

        sh "npx lerna bootstrap --scope ${it} -- --production"

        dir("packages/${it.replace('@filename2/', '')}") {

          sh "npm publish"





Currently, the supported languages to develop actions are Docker actions and JavaScript actions. Groovy is not supported.

If you want to use Groovy to develop an action, as the workaround, you can try to use the Composite run steps actions.

You can store the Groovy scripts in the repository of your customized Composite action, and in the run steps of this action to execute these scripts.

@brightran, i am not using groovy script for my workflow file.
i am using yaml formatted actions workflow i wanted to know how can i write the above job in yaml format


Do you mean like as this:

    runs-on: ubuntu-latest
      - name: builds
        run: |
          for it in "${changedPackages[@]}"
            if [[ $it == @filename1* ]]; then
              build job
              . . .

            if [[ $it == @filename2* ]]; then
              npx lerna bootstrap --scope $it -- --production
              . . .

@brightran, yeah the same thing i will test it out and check if it work

changed = sh returnStdout: true, script: 'npx lerna changed --json --all | jq ‘’

String changedPackages = changed.replaceAll(’"’,’’).split(’\n’).collect{it as String}

how can i write these both lines in yaml format


The example demo I posted above is running some bash shell scripts in the step, you may need to find some bash shell command lines that have the same functions as the two lines in your Groovy scripts.

actually first line is a shell command i got it but this line " String changedPackages = changed.replaceAll(’"’,’’).split(’\n’).collect{it as String} " how can we write in yaml for github actions