5

I want to set the GITHUB_OUPUT variables dynamically for a job and access them in another job. Below is what I am trying.

 par:
  runs-on: ["${{inputs.runner_name}}"]
  output:
  **<HERE I WANT THE VARIABLE OUTPUT TO BE DYNAMIC>**
  steps:
   - name: Par
     shell: powershell
     id: test
     run: |
         cd ${{github.workspace}}
         $json_path =  Get-ChildItem ${{inputs.param_name}} -recurse  | %{$_.FullName}
         $json = Get-Content  $json_path -Raw | ConvertFrom-Json
         $json.psobject.properties | ForEach {  $NAME=$_.Name ; $VALUE=$_.Value; echo $NAME,$VALUE ;echo "$NAME=$VALUE" >> $GITHUB_OUTPUT }
                

In the next job i want to do ( if ${{ needs.par.outputs.<here I know what variable I should reference> }} -ne null )

Is that possible?

2
  • @Azeem these all show an explicit definition for each job output. Under the job.outputs they are defining the outputted key and pointing it to the step output key as well. # Map a step output to a job output outputs: output1: ${{ steps.step1.outputs.test }} output2: ${{ steps.step2.outputs.test }} Commented Feb 3 at 17:34
  • See github.com/actions/runner/pull/2477. Commented Feb 3 at 17:46

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.