Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Seems like actionlint lack support to detect when we call reusable workflow in the main workflow. #407

Open
IAMDAVID0921 opened this issue Mar 6, 2024 · 2 comments

Comments

@IAMDAVID0921
Copy link

IAMDAVID0921 commented Mar 6, 2024

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 }}
@IAMDAVID0921 IAMDAVID0921 changed the title Seems like actionlint lack support when we call reusable workflow in the main workflow. Seems like actionlint lack support to detect when we call reusable workflow in the main workflow. Mar 6, 2024
@rhysd
Copy link
Owner

rhysd commented May 2, 2024

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.

@rhysd
Copy link
Owner

rhysd commented May 2, 2024

Please tell me entire workflows which can reproduce your issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants