Job.<job_id>.name changes job ID field

Hi All,

I have a GitHub Action that checks if a list of jobs (Octokit.ActionsListJobsForWorkflowRunResponseJobsItem) contains the same id as the environment variable GITHUB_JOB in order to get the correct conclusion status.

Checking the workflow data object, I can see that the name field is filed with the jobs.<job_id> content, and this matches with the GITHUB_JOB variable.

However , when I set the jobs.<job_id>.name , the field name changed for this one as well, and I can’t compere with GITHUB_JOB anymore as this sticks to the jobs.<job_id>. Is this expected?

Is there any other way to check the conclusion based on the current job ? Ideally would be great get it from job id (integer).

am I missing something?

1 Like

I am afraid that I have to say yes, this is expected.
The name property of Octokit.ActionsListJobsForWorkflowRunResponseJobsItem will be jobs.<job_id>.name when you specify name key in the job.

There is a job.status context which could show the current status of the job. Possible values are success , failure , or cancelled .

You could set job.status to an env variable or input variable (using ${{ job.status }} syntax) for a GitHub Action. For example:

    - run: echo hello
    - name: job status
      run: |
         echo $var1 
        var1: ${{ job.status }}

@femrtnz , Could job.status match your requirement? If you meet any other questions about it, please feel free to update here.

Hi @yanjingzhu

No. I don’t want to control the status based on env variable, however status is what I want at the end.

To be more specific this is the issue :

and this is the validation:

I have reported this issue to GitHub engineering team in our internal channel. I’ll keep you updated here. Thank you for your understanding.

1 Like

I got response from engineering team:
Currently , we don’t have the job_id in the Actions workflow jobs API. But we will look into adding it. Can see how that would be helpful.

1 Like

Hi @yanjingzhu
Just checking if you guys have any update on that or if at least this feature is on your backlog.