Dynamic Output Variable Names? #32628
-
|
I have a very verbose yaml file that I'm wondering if I can use expression syntax to reduce. Specifically I'd like to do something like this The above syntax does not work and was only a shot in the dark as I don't believe this to be a feature generally. Can anyone point me to a better solution or the correct syntax? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
|
Write whatever data you want to transfer to a file (JSON would be an obvious choice) and transfer that instead, e.g. as an artifact. That way you have one object that can have whatever values and even structure you need. For a small JSON object you could even create a compact (single line) encoding and transfer it as an output. |
Beta Was this translation helpful? Give feedback.
-
jobs:
job1:
runs-on: ubuntu-latest
strategy:
matrix:
os: ['linux', 'windows','macos']
arch: ['x86','x64']
outputs:
${{ matrix.os }}_${{ matrix.arch }}_result: ${{ steps.step1.outputs.test }}
steps:
- id: step1
run: "test=${{ matrix.os }} - ${{ matrix.arch }}" >> $GITHUB_OUTPUT
job2:
runs-on: ubuntu-latest
needs: job1
steps:
- run: echo ${{ needs.job1.outputs["linux_x86_result"] }}Support has been added! |
Beta Was this translation helpful? Give feedback.
Write whatever data you want to transfer to a file (JSON would be an obvious choice) and transfer that instead, e.g. as an artifact. That way you have one object that can have whatever values and even structure you need.
For a small JSON object you could even create a compact (single line) encoding and transfer it as an output.