Quantcast
Channel: Passing env variable inputs to a reusable workflow - Stack Overflow
Viewing all articles
Browse latest Browse all 5

Passing env variable inputs to a reusable workflow

$
0
0

I'm trying to call a reusable workflow from another one, passing it some input variables. In the caller workflow I have some environment variables that I want to pass as input to the reusable one, like so:

env:  SOME_VAR: bla_bla_bla  ANOTHER_VAR: stuff_stuffjobs:  print:    runs-on: ubuntu-latest    steps:      - name: Print inputs passed to the reusable workflow        run: |          echo "some var: $SOME_VAR"          echo "another var: $ANOTHER_VAR"  call_reusable:    uses: ...    with:      input_var: $SOME_VAR      another_input_var: $ANOTHER_VAR

the reusable workflow:

on:  workflow_dispatch:  workflow_call:    inputs:      input_var:        required: true        type: string      another_input_var:        required: true        type: stringjobs:  the_job:    runs-on: ubuntu-latest    steps:      - name: Print inputs        run: |          echo "input_var: ${{ inputs.input_var }}"          echo "another_input_var: ${{ inputs.another_input_var }}"

The Print inputs passed to the reusable workflow step works fine - all variables are correctly printed. However, the Print inputs step in the reusable workflow (the callee) does not work as expected - all the variables are empty.

I couldn't find anything in the docs suggesting that there is something wrong with my approach so, the way I see it, this should be working. Still, looking at the logs there is something wrong, as in the reusable workflow (callee) I can see:

Run echo "input_var: $SOME_VAR"  echo "another_input_var: $ANOTHER_VAR"  shell: /usr/bin/bash -e {0}input_var: another_input_var: 

I tried wrapping the values in the with: block in $(echo) but that didn't work.

Any ideas?


Viewing all articles
Browse latest Browse all 5

Latest Images

Trending Articles





Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>
<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596344.js" async> </script>