# Reference job name inside job

**URL:** <https://discuss.circleci.com/t/reference-job-name-inside-job/46156>\
**Category:** Build Environment\
**Created:** [November 18, 2022, 3:27am UTC](https://discuss.circleci.com/t/reference-job-name-inside-job/46156 "2022-11-18T03:27:45Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![dibbitson](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/dibbitson/32/31640_2.png) [@dibbitson](https://discuss.circleci.com/u/dibbitson)\
**Post date:** [November 18, 2022, 3:27am UTC](https://discuss.circleci.com/t/reference-job-name-inside-job/46156/1 "2022-11-18T03:27:45Z")

</div>

Hi, is there some self referential way to access the job name given by the name key at the workflow level inside of the job? Given that “name” is a reserved parameter I thought maybe something like this would work:

```auto
jobs:
    build:
        docker:
            - image: buildpack-deps
        resource_class: small
        steps:
            - mycommand:
                jobname: <<parameters.name>> # <---- How can I achieve this?!?

workflows:
    build-workflow:
        jobs:
            - build:
                name: somename
    

```

I’ve tried a few other things also to no avail, hoping there is a way thanks!

---

<div class="post-metadata">

**Author:** ![rit1010](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/rit1010/32/34738_2.png) [@rit1010](https://discuss.circleci.com/u/rit1010)\
**Post date:** [November 18, 2022, 10:21am UTC](https://discuss.circleci.com/t/reference-job-name-inside-job/46156/2 "2022-11-18T10:21:25Z")

</div>

I can not say why name is a reserved parameter, but to do what you wish to do, you would use parameters as shown here under 'Passing parameters to jobs"

```
https://circleci.com/docs/jobs-steps/

```

---

<div class="post-metadata">

**Author:** ![dibbitson](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/dibbitson/32/31640_2.png) [@dibbitson](https://discuss.circleci.com/u/dibbitson)\
**Post date:** [November 18, 2022, 4:38pm UTC](https://discuss.circleci.com/t/reference-job-name-inside-job/46156/3 "2022-11-18T16:38:36Z")

</div>

Thanks yeah I’ve seen that.

I think the job name you specify under workflows is different from the name you give a run step.

workflows → Shows up under Github UI as the name of the job  
run step name → Shows up under the CircleCI UI as the currently running step under that job.

I’m trying to reuse the job\_name and pass it as a parameter through to my run step to avoid having to redundantly specify the same string twice.

```auto
jobs:
    build:
        parameter:
            someparam:
                type: string
        docker:
            - image: buildpack-deps
        resource_class: small
        steps:
            - mycommand:
                jobname: <<parameters.somename>> # <---- Would be nice to use job name here, not redundant param

workflows:
    build-workflow:
        jobs:
            - build:
                name: somename # <---- shows up under Gihub UI
                paramname: somename # <---- passed down to run step name. redundant!
    

```

Hopefully that explains a bit better what I’m asking for.  
Thanks
