toolkit icon indicating copy to clipboard operation
toolkit copied to clipboard

Bug: `context.job` fails to take into account `jobs.<job_id>.name` value

Open rdhar opened this issue 1 year ago • 2 comments

Describe the bug

It appears as if context.job returns the value for jobs.<job_id> instead of jobs.<job_id>.name, which the user can opt to set via workflow syntax.

If jobs.<job_id>.name is set, can we return its value within context.job (or within a similarly-named new variable)?

To Reproduce

Steps to reproduce the behavior:

  1. Create a workflow like so:
    on: pull_request
    jobs:
      demo:
        name: Demo Job
        runs-on: ubuntu-latest
        steps:
          - name: Echo job name
            uses: actions/github-script@v7
            with:
              script: console.log(JSON.stringify(context.job));
    
  2. Observe as the output logs "demo" instead of "Demo Job".

Expected behavior

Instead of "demo", I would expect context.job to output "Demo Job" as that is its job name. If that's not possible, at least have a dedicated context.job_name to return the proper job name.

rdhar avatar May 12 '24 17:05 rdhar

context comes from @actions/github so I'll transfer this to the toolkit repo.

joshmgross avatar May 13 '24 17:05 joshmgross

Thank you for transferring @joshmgross, and feel free to let me know if I can provide any more information to help troubleshooting.

rdhar avatar May 15 '24 09:05 rdhar