[GH-ISSUE #970] Issue: default environment variables doesn't follow recent documents #569

Closed
opened 2026-03-01 21:44:34 +03:00 by kerem · 5 comments
Owner

Originally created by @ethinx on GitHub (Jan 27, 2022).
Original GitHub issue: https://github.com/nektos/act/issues/970

System information

- Operating System: macOS
- Architecture: x64 (64-bit)
- Apple M1: no
- Docker version: 20.10.12
- Docker image used in `act`: < can be omitted if it's included in log >
- `act` version: 0.2.25

Expected behaviour

There is a github env called GITHUB_REF_NAME

Actual behaviour

env.GITHUB_REF_NAME is not set

check https://github.com/nektos/act/blob/master/pkg/runner/run_context.go, it seems that the supported env in act is not the same to the recent documentation: https://docs.github.com/en/actions/learn-github-actions/environment-variables#default-environment-variables

Workflow and/or repository

Get ${{ env.GITHUB_REF_NAME }} in steps

Steps to reproduce

Get ${{ env.GITHUB_REF_NAME }} in steps

act output

Originally created by @ethinx on GitHub (Jan 27, 2022). Original GitHub issue: https://github.com/nektos/act/issues/970 ## System information - Operating System: macOS - Architecture: x64 (64-bit) - Apple M1: no - Docker version: 20.10.12 - Docker image used in `act`: < can be omitted if it's included in log > - `act` version: 0.2.25 ## Expected behaviour There is a github env called `GITHUB_REF_NAME` ## Actual behaviour `env.GITHUB_REF_NAME` is not set check https://github.com/nektos/act/blob/master/pkg/runner/run_context.go, it seems that the supported env in `act` is not the same to the recent documentation: https://docs.github.com/en/actions/learn-github-actions/environment-variables#default-environment-variables ## Workflow and/or repository Get `${{ env.GITHUB_REF_NAME }}` in steps ## Steps to reproduce Get `${{ env.GITHUB_REF_NAME }}` in steps ## `act` output
kerem 2026-03-01 21:44:34 +03:00
Author
Owner

@github-actions[bot] commented on GitHub (Feb 27, 2022):

Issue is stale and will be closed in 14 days unless there is new activity

<!-- gh-comment-id:1052827637 --> @github-actions[bot] commented on GitHub (Feb 27, 2022): Issue is stale and will be closed in 14 days unless there is new activity
Author
Owner

@thiskevinwang commented on GitHub (Apr 24, 2022):

+1 — Would be nice to have echo ${GITHUB_REF_NAME} behave similar to echo ${GITHUB_REF}

Thanks for this great tool by the way 🙏

<!-- gh-comment-id:1107897556 --> @thiskevinwang commented on GitHub (Apr 24, 2022): +1 — Would be nice to have `echo ${GITHUB_REF_NAME}` behave similar to `echo ${GITHUB_REF}` Thanks for this great tool by the way 🙏
Author
Owner

@ChristopherHX commented on GitHub (Apr 26, 2022):

On my low priority backlog

<!-- gh-comment-id:1110133571 --> @ChristopherHX commented on GitHub (Apr 26, 2022): _On my low priority backlog_
Author
Owner

@thiskevinwang commented on GitHub (Apr 26, 2022):

@ChristopherHX I'd be happy to open a PR for this.

Is it pretty much adding an additional line here?
github.com/nektos/act@3f2469bf53/pkg/runner/run_context.go (L626)

  env["GITHUB_REF"] = github.Ref
+ env["GITHUB_REF_NAME"] = github.RefName
<!-- gh-comment-id:1110209318 --> @thiskevinwang commented on GitHub (Apr 26, 2022): @ChristopherHX I'd be happy to open a PR for this. Is it pretty much adding an additional line here? https://github.com/nektos/act/blob/3f2469bf5385b90da5f6a5d9922ccf9c9d7274a6/pkg/runner/run_context.go#L626 ```diff env["GITHUB_REF"] = github.Ref + env["GITHUB_REF_NAME"] = github.RefName ```
Author
Owner

@ChristopherHX commented on GitHub (Apr 26, 2022):

This also needs to be added there
github.com/nektos/act@3f2469bf53/pkg/model/github_context.go (L20)
Populated here based on github.ref without refs/heads/ or refs/tags/.
github.com/nektos/act@3f2469bf53/pkg/runner/run_context.go (L552)
I would add it together with github.ref_type

I already do this in my act replacement backed by the official actions/runner:
github.com/ChristopherHX/runner.server@565a185a74/src/Runner.Server/Controllers/MessageController.cs (L939-L940)

<!-- gh-comment-id:1110223828 --> @ChristopherHX commented on GitHub (Apr 26, 2022): This also needs to be added there https://github.com/nektos/act/blob/3f2469bf5385b90da5f6a5d9922ccf9c9d7274a6/pkg/model/github_context.go#L20 Populated here based on github.ref without `refs/heads/` or `refs/tags/`. https://github.com/nektos/act/blob/3f2469bf5385b90da5f6a5d9922ccf9c9d7274a6/pkg/runner/run_context.go#L552 **I would add it together with github.ref_type** I already do this in my act replacement backed by the official actions/runner: https://github.com/ChristopherHX/runner.server/blob/565a185a74614b6ab7b520f355d458706c148793/src/Runner.Server/Controllers/MessageController.cs#L939-L940
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/act#569
No description provided.