0

Before posting this here, I explored about this topic in github actions documentation and other forums including SO. The problem statement is - I download a file from my reusable workflow. I keep this in reusable workflow because multiple projects need the same download function. I need to use this from my caller workflow. Is this even possible? If not possible, are there any options to address this usecase? My code snippet below:

- name: Download CSSP Secrets
    id: cssp_secrets
    run: |
      az keyvault secret show --name $AZURE_SECRET_NAME --vault-name $AZURE_KEYVAULT_NAME --query value -o tsv > $CSSP_KEY_FILE_NAME
      echo "ENV_CSSP_KEY_FILE_PATH=$GITHUB_WORKSPACE/$CSSP_KEY_FILE_NAME" >> $GITHUB_ENV
      echo $GITHUB_ENV
user264953
  • 1,837
  • 8
  • 37
  • 63
  • 1
    See the [limitations](https://docs.github.com/en/actions/using-workflows/reusing-workflows#limitations) of reusable workflows. You cannot use env vars, use [output parameters](https://docs.github.com/en/actions/using-workflows/reusing-workflows#using-outputs-from-a-reusable-workflow) instead. – Azeem Jun 21 '23 at 15:13
  • 1
    Does this answer your question? [Passing env variable inputs to a reusable workflow](https://stackoverflow.com/questions/73305126/passing-env-variable-inputs-to-a-reusable-workflow) – Azeem Jun 21 '23 at 15:23
  • OK, tried this - https://stackoverflow.com/questions/73702333/github-actions-reuse-outputs-from-other-reusable-workflows . In the snippet above without using a reusable workflow, I output this to a .properties file($CSSP_KEY_FILE_NAME). In this case, what am I supposed to do? Take the output of az keyvault secret show on to a variablein reusable workflow, pass it to the caller workflow and then output the variable to a .properties file there? – user264953 Jun 21 '23 at 17:16
  • 1
    Yes, something like should work. You should mask it before setting it to output parameter. See https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#masking-a-value-in-a-log. – Azeem Jun 23 '23 at 05:22

0 Answers0