Skip to content

Reusable Workflows, Jobs outputs #26813

Reusable Workflows, Jobs outputs #26813
Oct 1, 2021 · 5 answers

I’m trying to implement reusable workflow as described here: Reusing workflows - GitHub Docs

on the workflow I have following jobs (simplified):

jobs:
  get-config:
    name: Get Deployment Config
    runs-on: ubuntu-latest
    outputs:
      config: ${{ steps.get-config.outputs.config }}
    steps:
      - name: Get Config
        uses: action000
        id: get-config
  - run: |
      echo '${{ steps.get-config.outputs.config }}' # returns value

use-config:
needs: [get-config]
name: ccccc
runs-on: ubuntu-latest
steps:
- run: |
echo '${{ needs.get-config.outputs.config }}' # empty string

It seems like needs does not work inside of called workflow.

I understand that the docs stands for some limitations:

  • Outputs generated by a called workflow can’t be accessed by the caller workflow.

Not sure if this is a case given I’m trying to access outputs locally.

Fixed as of Today, I can confirm job outputs are now printed to the log

  <a href="https://github.com/ChristopherHX/newcomposite-sample/actions/runs/1309435631" target="_blank" rel="noopener nofollow ugc">github.com</a>

Update main.yml

  <div class="github-info">
    .github/workflows/main.yml <span class="github-run-number">#28</span>
  </div>

It’s not that github wouldn’t apply changes to the actions-service at any point of time, like between our posts

Replies

5 suggested answers

Is config a secret? I had this problem trying to output a secret in the first job otherwise it should work as I am using a similar setup in our workflows. In my case there was a line in the raw log complaining about the secret being used in an output.

0 replies

No, it’s not.

As you can also see that the config output was set successfully on get-config job.

0 replies

I also tried to use job outputs, indeed needs.*.outputs are empty in myjobb. The hardcoded output myin is not a secret so this must be a bug of the github actions beta.

Here my public workflow run, which prints an empty needs context in myjobb.

While running it with my own action service implementation locally the same workflow has the expected outputs in the needs context.

I think that mforutan’s experience is about normal workflows, not about reusable workflows. Reusable workflows are documented since last Tuesday.

0 replies

Fixed as of Today, I can confirm job outputs are now printed to the log

  <a href="https://github.com/ChristopherHX/newcomposite-sample/actions/runs/1309435631" target="_blank" rel="noopener nofollow ugc">github.com</a>

Update main.yml

  <div class="github-info">
    .github/workflows/main.yml <span class="github-run-number">#28</span>
  </div>

It’s not that github wouldn’t apply changes to the actions-service at any point of time, like between our posts

0 replies
Answer selected

Awesome, works for me too!

0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants