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"

        }

      }

    }

@MukeshSathyanarayana,

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

@MukeshSathyanarayana,

Do you mean like as this:

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

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

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

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

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

how can i write these both lines in yaml format

@MukeshSathyanarayana,

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.

@brightran,
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