More granular control over workflow job approval (feature request)

Hi, i have a request to further improve github actions. Currently there is the possibility to request manual approval of a workflow/job by configuring a environment which needs to be approved by a user. I would have some more granular options to request a approval, for example based on the output of a previous job. It would be nice if a job would take some configuration which would enable / disable manual approval of the job based on a conditional expression.

It’s already possible to configure multiple environments, let a job decide which environment to use and then let another job pick that environment dynamically:

name: Dynamic Environment

on: push

jobs:
  job1:
    runs-on: ubuntu-latest
    outputs:
      myenv: ${{ steps.determine-env.outputs.myenv }}
    steps:
      - name: Determine Environment
        id: determine-env
        run: |
          echo "::set-output name=myenv::staging"
  job2:
    runs-on: ubuntu-latest
    needs: job1
    environment: ${{ needs.job1.outputs.myenv }}
    steps:
      - name: Print Environment
        run: |
          echo "myenv = ${{ needs.job1.outputs.myenv }}"

If you don’t set an environment or try to set it to an empty string or the like, then it will unfortunately fail. So you have to pick an environment once you add job.<job_id>.environment. But as a workaround, you could create a blank environment without any of the protection rules set and just pick that one if you don’t want to enforce a review or wait timer.