[GH-ISSUE #1734] Support for vars context / Repository variables #847

Closed
opened 2026-03-01 21:46:52 +03:00 by kerem · 1 comment
Owner

Originally created by @MannyAdumbire on GitHub (Apr 17, 2023).
Original GitHub issue: https://github.com/nektos/act/issues/1734

Act version

0.2.44

Feature description

It would be great to have the option to passing repository variables in the same way as for secrets.

  -s, --secret stringArray                                secret to make available to actions with optional value (e.g. -s mysecret=foo or -s mysecret)
      --secret-file string                                file with list of secrets to read from (e.g. --secret-file .secrets) (default ".secrets")

In testing, I noticed an action that contains...

env:
  REPO_VAR: ${{ vars.REPO_VAR }}

Fails with message:

[Push to Pantheon/set-pantheon-env] Unable to interpolate expression 'format('{0}', vars.REPO_VAR)': Unavailable context: vars

Can act be made to work with the vars context?
image

My workaround has been changing the vars to secrets and passing them to --secret.

I am new to GH Actions, and to act, so sorry I'm just missing something obvious, and thanks for any help!

Originally created by @MannyAdumbire on GitHub (Apr 17, 2023). Original GitHub issue: https://github.com/nektos/act/issues/1734 ### Act version 0.2.44 ### Feature description It would be great to have the option to passing repository variables in the same way as for secrets. ``` -s, --secret stringArray secret to make available to actions with optional value (e.g. -s mysecret=foo or -s mysecret) --secret-file string file with list of secrets to read from (e.g. --secret-file .secrets) (default ".secrets") ``` In testing, I noticed an action that contains... ``` env: REPO_VAR: ${{ vars.REPO_VAR }} ``` Fails with message: ``` [Push to Pantheon/set-pantheon-env] Unable to interpolate expression 'format('{0}', vars.REPO_VAR)': Unavailable context: vars ``` Can act be made to work with the [vars context](https://docs.github.com/en/actions/learn-github-actions/contexts#vars-context)? ![image](https://user-images.githubusercontent.com/4621391/232357728-3af06357-01de-4ae6-84b2-78c03981cf23.png) My workaround has been changing the vars to secrets and passing them to `--secret`. I am new to GH Actions, and to act, so sorry I'm just missing something obvious, and thanks for any help!
kerem 2026-03-01 21:46:52 +03:00
Author
Owner

@MannyAdumbire commented on GitHub (Apr 17, 2023):

Never mind, using vars works when they are passed in a file to --env-file flag. :D

<!-- gh-comment-id:1510601859 --> @MannyAdumbire commented on GitHub (Apr 17, 2023): Never mind, using vars works when they are passed in a file to `--env-file` flag. :D
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#847
No description provided.