Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
rdhar opened this issue May 12, 2024 · 2 comments
Open

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

rdhar opened this issue May 12, 2024 · 2 comments
Labels

Comments

@rdhar
Copy link

rdhar commented May 12, 2024

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.

@joshmgross
Copy link
Member

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

@joshmgross joshmgross transferred this issue from actions/github-script May 13, 2024
@rdhar
Copy link
Author

rdhar commented May 15, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants