My SHA/commit-hash doesn’t get printed in the called workflow. I have 2 workflow as a simple python file:
call_other_workflow.yml:
name: call other workflow
on:
push
jobs:
#------------------------------------
prep:
name: prep
runs-on: ubuntu-latest
outputs:
sha:
${{ steps.short-sha.outputs.sha }}
steps:
- name: Checkout
uses: actions/[email protected]
with:
submodules: recursive
- name: Short-Sha
uses: benjlevesque/[email protected]
id: short-sha
with:
length: 8
#------------------------------------
call-other-workflow:
name: call-other-workflow
needs: [ prep ]
uses: ./.github/workflows/other_workflow.yml
with:
commit-hash: ${{ needs.prep.outputs.sha }}
other_workflow.yml:
name: other workflow
on:
workflow_dispatch:
inputs:
commit-hash:
description: Hash of the commit
type: string
required: true
workflow_call:
inputs:
commit-hash:
description: Hash of the commit
type: string
required: true
jobs:
#------------------------------------
prep:
runs-on: ubuntu-latest
steps:
- name: Print SHA
run: echo "${{ inputs.commit-hash }}"
- name: Checkout
uses: actions/[email protected]
with:
submodules: recursive
- name: Call python script
env:
COMMIT_HASH: ${{ github.event.inputs.commit-hash }}
run: python3 scripts/print_commit_hash.py
..and a simple python-file:
scripts/print_commit_hash.py:
import os
print(os.environ["COMMIT_HASH"])
When this has run, I can see that the SHA makes it to the ‘other_workflow.yml’, looking at [Set up job > Inputs], but in [Call python script > env: COMMIT_HASH: ] it shows as empty. When I call other_workflow.yml manually the ‘input’ gets printed. What is going (wr)on(g)?