Seems like actionlint lack support to detect when we call reusable workflow in the main workflow.
IAMDAVID0921 opened this issue · comments
David Guo commented
For example, (All pseudo code)
In Main workflow:
we call reusable workflow like:
Build-abc:
uses: ./.github/workflows/reusable_workflow.yml
with:
xxxx: xxxxx
yyyy: yyyyy
Then we want to use the abc_output from the reusable workflow as an input in another reusable workflow, we do something like:
Run-abc-test:
uses: ./.github/workflows/another_reusable_workflow.yml
with:
abc_value: ${{ needs.Build-abc.outputs.abc_version }}
This will make actionlint fail as
.github/workflows/another_reusable_workflow.yml:64:31: property "build-abc" is not defined in object type {promote-bundle: {outputs: {}; result: string}} [expression]
|
64 | abc_value: ${{ needs.Build-abc.outputs.abc_version }}
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Error: Process completed with exit code 1.
In .github/workflows/reusable_workflow.yml:
name: Build abc
on:
workflow_call:
inputs:
xxxx:
required: true
type: string
yyyy:
required: true
type: string
outputs:
abc_version:
value: ${{ xxxx.xxxx.xxxx }}
Linda_pp commented
I can't fully understand your issue only from the code snippets, but I could not reproduce this from the following workflows.
main.yml
on: push
jobs:
Build-abc:
uses: ./.github/workflows/reusable_workflow.yml
run-abc-test:
needs: [Build-abc]
uses: ./.github/workflows/another_reusable_workflow.yml
with:
abc_value: ${{ needs.Build-abc.outputs.abc_version }}
reusable_workflow.yml
on:
workflow_call:
outputs:
abc_version:
description: "..."
value: "..."
jobs:
triage:
runs-on: ubuntu-latest
steps:
- run: echo reusable
another_reusable_workflow.yml
on:
workflow_call:
inputs:
abc_value:
description: "..."
type: string
jobs:
triage:
runs-on: ubuntu-latest
steps:
- run: echo another reusable
actionlint reported no error.
Linda_pp commented
Please tell me entire workflows which can reproduce your issue.