Skip to content

How to do dynamic "uses" for reusable workflow #45342

Discussion options

You must be logged in to vote

Do you have a finite amount of possible environments? If no, you can skip reading this.

I would classify this as a workaround, like already mentioned expressions are forbidden in uses.
Create a proxy workflow octocat/pipelines/.github/workflows/customer-deploy.yaml@main, which references each of the possible environments. You only need to update it if you modify inputs and outputs.

on: workflow_call
# TODO add some inputs if you really need them, you example inputs could be removed without loss of information.
jobs:
  development:
    if: github.ref_name == 'development'
    uses: "octocat/pipelines/.github/workflows/customer-deploy.yaml@development"
    with:
      environment_name: ${{ …

Replies: 10 comments 6 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by guilhermeblanco
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@AmitArie
Comment options

Comment options

You must be logged in to vote
2 replies
@ChristopherHX
Comment options

@Piedone
Comment options

This comment was marked as spam.

Comment options

You must be logged in to vote
2 replies
@wmiller112
Comment options

@1oglop1
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@gavinclarkeuk
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Actions Build, test, and automate your deployment pipeline with world-class CI/CD Question