How to make a conditions based on a previous step output

Is there a way I can reproduce this in drone, so in these steps below I am running a cmd line tool which can detect which projects have changed in a repo, the repo has components and builds up projects from the components, I then want to deploy any of the projects have that have changed so I need to check if the project exists in the lists from the cmd line tool.

Is this possible ?

      - name: Set Env
        run: |-
          cd workspace
          echo "CHANGED_PROJECTS=$(clojure -M:poly ws get:changes:changed-or-affected-projects since:previous-release skip:dev)" >> $GITHUB_ENV

      - name: Build api
        if: contains('${{ env.CHANGED_PROJECTS }}', 'example-api')
        run: |-
          cd  workspace/projects/example-api
          clojure -X:uberjar