actions / actions/toolkit

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

Open
#1,734 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

github
Dominant language
TypeScript
Stars
5.9k
Forks
1.8k
PR merge metrics
No merged PRs in 30d

Description

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the actions/github-script entry point and trace how the workflow context exposes context.job. Reproduce the example workflow with jobs.demo.name set to “Demo Job,” then compare the current output with the workflow syntax semantics. Done means the chosen context value or new variable consistently exposes the configured job name and the behavior is covered by an appropriate test.

Written by the indexing model from the issue text.

Assessment

Tech stack
github-actions, typescript
Domain
api, devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.