如何将脚本插入 YML 文件,即 config.yml (CircleCI) 和 github 操作

How to I plug in script to YML file i.e. config.yml (CircleCI) and in github action

我有以下 shell 脚本:

    for var in $(curl -u "abc_oOQxMv:tgMn6FYCKJcd6ujuDLEK" -X GET "https://api-cloud.browserstack.com/app-automate/recent_apps" | jq '.[] | select(.custom_id =="android")' | jq -r '.app_id')
    do
      echo "Deleting $var"
      curl -u "abc_oOQxMv:tgMn6FYCKJcd6ujuDLEK" -X DELETE "https://api-cloud.browserstack.com/app-automate/app/delete/$var"
    done

如何在Github Action中将其写入YML文件(即CircleCI中的config.yml)?

您可以 运行 在工作流 yaml 文件中使用 run : |(带管道)在一个步骤中使用多行命令。

例如:

script-job:
  runs-on: ubuntu-latest
  steps:
    - name: Run my script
      shell: bash
      run: |
        for var in $(curl -u "abc_oOQxMv:tgMn6FYCKJcd6ujuDLEK" -X GET 
           "https://api-cloud.browserstack.com/app-automate/recent_apps" | jq '.[] | select(.custom_id =="android")' | jq -r '.app_id')
        do
           echo "Deleting $var"
           curl -u "abc_oOQxMv:tgMn6FYCKJcd6ujuDLEK" -X DELETE "https://api-cloud.browserstack.com/app-automate/app/delete/$var"
        done