0

I have created two reusable workflow in abc repo javaci.yml databaseci.yml

I can trigger reusable workflow from caller workflow simultaneously but I need to choose any one or both yml file to trigger by using parameter

below are the my caller workflow

name: caller workflow

on: workflow_dispatch:

jobs:

trigger_javaci: 
   uses: abc/github-actions-shared-workflow/.github/workflows/javaci.yml@main
   
   secrets:
     Workflow2_PAT_TOKEN_GITHUB: ${{ secrets.Workflow2_PAT_TOKEN_GITHUB }}

trigger_databaseci: 
   uses: abc/github-actions-shared-workflow/.github/workflows/databaseci.yml@main


   secrets:
     Workflow2_PAT_TOKEN_GITHUB: ${{ secrets.Workflow2_PAT_TOKEN_GITHUB }}

While running Caller workflow, am getting both reusable workflow, but i want particularly any one called workflow to trigger by using parameter values.

So kindly help on this...

Thank you

1 Answers1

0

Finally I found the solution to call either one or both reusable workflow from caller workflow

name: multiple-reusable-caller workflow

on:
 workflow_dispatch:
   inputs: 
     javaci: 
        type: boolean
        description: 'deploy javaci'
        required: true
     databaseci: 
        type: boolean
        description: 'deploy databaseci'
        required: true        
 
jobs:

    deploy_javaci: 
       if: ${{github.event.inputs.javaci == 'true'}}
       uses: abc/reusable-workflow-ci/.github/workflows/javaci.yml@main
       
       secrets:
         Workflow2_PAT_TOKEN_GITHUB: ${{ secrets.Workflow2_PAT_TOKEN_GITHUB }}

    deploy_databaseci: 
       if: ${{github.event.inputs.databaseci == 'true'}}
       uses: abc/reusable-workflow-ci/.github/workflows/databaseci.yml@main
       
       secrets:
         Workflow2_PAT_TOKEN_GITHUB: ${{ secrets.Workflow2_PAT_TOKEN_GITHUB }}
Jeremy Caney
  • 7,102
  • 69
  • 48
  • 77
  • Remember that Stack Overflow isn't just intended to solve the immediate problem, but also to help future readers find solutions to similar problems, which requires understanding the underlying code. This is especially important for members of our community who are beginners, and not familiar with the syntax. Given that, **can you [edit] your answer to include an explanation of what you're doing** and why you believe it is the best approach? – Jeremy Caney Jul 29 '23 at 00:52