I have 2 workflows. One is calling the other.
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
- name: print SHA
run: echo $SHA
env:
SHA: ${{ env.SHA }}
#------------------------------------
print-sha:
name: print-sha
needs: [ prep ]
runs-on: ubuntu-latest
steps:
- name: print SHA
run: echo $SHA
env:
SHA: ${{ needs.prep.outputs.sha }}
#------------------------------------
call-other-workflow:
name: call-other-workflow
needs: [ print-sha ]
uses: ./.github/workflows/other_workflow.yml
with:
commit-hash: "*c@ller*"
# commit-hash: ${{ needs.prep.outputs.sha }}
The above workflow is calling this one:
name: other workflow
on:
workflow_call:
inputs:
commit-hash:
type: string
required: true
default: "d3faultX"
jobs:
#------------------------------------
prep:
runs-on: ubuntu-latest
steps:
- name: print SHA
run: echo "${{ inputs.commit-hash }}"
As you can see I want to pass the commit hash through. As the code is, it is just passing through a hardcoded string. That works. As soon as I exchange that for the reference to the SHA, it does not work any more. Why? I’ve put in other print steps to see I have a valid reference, etc. But I still cannot work out why this is not working.
1