act icon indicating copy to clipboard operation
act copied to clipboard

'needs' is not defined

Open kochetkovIT opened this issue 6 years ago • 35 comments

Error ERRO[0002] Unable to interpolate string 'echo ${{ needs.pre.output1 }}' - [ReferenceError: 'needs' is not defined] when try to following workflow:

jobs:
  pre:
    runs-on: ubuntu-latest
    steps:
      - run: echo '::set-env name=VAR1::value1'
    outputs:
      output1: ${{ env.VAR1 }}

  job1:
    runs-on: ubuntu-latest
    needs: [pre]
    steps:
      - run: echo ${{ needs.pre.outputs.output1 }}

This syntax is working in workflow ran by Github Actions, as we do use it in our project's CI.

kochetkovIT avatar Jun 25 '20 13:06 kochetkovIT

+1

snipebin avatar Jun 30 '20 01:06 snipebin

any workaround for this?

Nilegfx avatar Aug 08 '20 15:08 Nilegfx

This feature would be really helpful

davidwestberry avatar Aug 26 '20 16:08 davidwestberry

Issue is stale and will be closed in 7 days unless there is new activity

github-actions[bot] avatar Oct 26 '20 00:10 github-actions[bot]

Issue is stale and will be closed in 14 days unless there is new activity

github-actions[bot] avatar Jan 16 '21 01:01 github-actions[bot]

+1

matiasalbarello avatar Jan 19 '21 09:01 matiasalbarello

+1

njimenezotto avatar Jan 27 '21 15:01 njimenezotto

+1

seru1us avatar Feb 09 '21 19:02 seru1us

+1

anthonykawa avatar Feb 18 '21 08:02 anthonykawa

+1

ch1seL avatar Mar 07 '21 17:03 ch1seL

+1

abelcha avatar Mar 15 '21 18:03 abelcha

+1

almahmoud avatar Mar 23 '21 04:03 almahmoud

+1

nikultimo avatar Mar 31 '21 12:03 nikultimo

Community needs "needs" :)

gcoban avatar Apr 11 '21 19:04 gcoban

+1

gakonst avatar Apr 14 '21 23:04 gakonst

This is a huge blocker for us. The "needs" parameter enables proper, efficient parallel jobs to be run that have a common set of steps that need to be run for all of them.

We have a number of applications that build for multiple environments but share several common steps. Without being able to use the "needs" option, we have to resort to duplicating steps and waiting on things to run serially which is FAR less than ideal.

Joshuapwilley avatar Apr 16 '21 21:04 Joshuapwilley

We are also using the needs parameter in many workflows, but this breaks usage of act and we cant test locally anymore. Adding support for this would be really nice.

agentschmitt avatar Apr 19 '21 09:04 agentschmitt

Unfortunately here the same: needing needs but it blocks simply using act for our development process.

hcguersoy-oc avatar Jul 02 '21 09:07 hcguersoy-oc

@hcguersoy-oc Just wanted to let you know if you didn't notice; the fix was merged yesterday! :) (see: #629 as per mergify update)

adamthedog avatar Jul 02 '21 17:07 adamthedog

When I run this example https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#example-8

name: Diff AccessDB
on: [pull_request]

jobs:
  job1:
    runs-on: ubuntu-latest
    # Map a step output to a job output
    outputs:
      output1: ${{ steps.step1.outputs.test }}
      output2: ${{ steps.step2.outputs.test }}
    steps:
      - id: step1
        run: echo "::set-output name=test::hello"
      - id: step2
        run: echo "::set-output name=test::world"
  job2:
    runs-on: ubuntu-latest
    needs: job1
    steps:
      - run: echo ${{needs.job1.outputs.output1}} ${{needs.job1.outputs.output2}}

Then I am getting this error in the latest @master version when I run act.

ERRO[0003] Unable to interpolate string '${{ steps.step2.outputs.test }}' - [TypeError: Cannot access member 'outputs' of undefined]

Is this a known limitation?

jacksoncougar avatar Jul 16 '21 18:07 jacksoncougar