Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Approvers as env variable #119

Open
djordjevicdjordje opened this issue May 24, 2024 · 1 comment
Open

Approvers as env variable #119

djordjevicdjordje opened this issue May 24, 2024 · 1 comment

Comments

@djordjevicdjordje
Copy link

Is it possible to set approvers to be read from the environment variable?

Its much easier to update the variable than to change the workflow each time I want to add new approver

@erjdev
Copy link

erjdev commented Jul 14, 2024

You could set the value as an environment variable then access it in the call to this action. This action does not need to support environment variables to accomplish your goal.

# my-workflow.yml
name: 'My Workflow'
#...
env:
  # Hard-coded approvers
  APPROVERS: user1,user2
#...
jobs:
  my-job:
    #...
    steps:
      #...
      - name: Manual Approval
        uses: trstringer/manual-approval@v1
        timeout-minutes: 15
        with:
          approvers: ${{ env.APPROVERS }}
          #...

Alternatively, you could create an environment variable at the repository level to represent this group of approvers and access them without having to set the env in each workflow. See https://docs.github.com/en/actions/learn-github-actions/variables#defining-configuration-variables-for-multiple-workflows for more information how to use variables and reference them in associated workflows.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants