[GH-ISSUE #1090] Issue: GITHUB_ACTIONS is always true #626

Closed
opened 2026-03-01 21:45:04 +03:00 by kerem · 4 comments
Owner

Originally created by @KnisterPeter on GitHub (Mar 30, 2022).
Original GitHub issue: https://github.com/nektos/act/issues/1090

Not sure if we should changes this behavior, but I think it might be good to follow githubs recommendation for this variable.

Expected behaviour

According to the docs the environment variable GITHUB_ACTIONS is set to true if the workflow is run by GITHUB_ACTIONS and it should be used to distinguish between local and non-local execution.

Actual behaviour

In the act codebase this variables is statically set to true.

github.com/nektos/act@11c3fb39dd/pkg/runner/run_context.go (L604)

Originally created by @KnisterPeter on GitHub (Mar 30, 2022). Original GitHub issue: https://github.com/nektos/act/issues/1090 Not sure if we should changes this behavior, but I think it might be good to follow githubs recommendation for this variable. ## Expected behaviour According to the [docs](https://docs.github.com/en/actions/learn-github-actions/environment-variables#default-environment-variables) the environment variable `GITHUB_ACTIONS` is set to true if the workflow is run by `GITHUB_ACTIONS` and it should be used to distinguish between local and non-local execution. ## Actual behaviour In the `act` codebase this variables is statically set to `true`. https://github.com/nektos/act/blob/11c3fb39dd5d3907baf8f13ef6953d0a21321cc2/pkg/runner/run_context.go#L604
kerem 2026-03-01 21:45:04 +03:00
Author
Owner
<!-- gh-comment-id:1082748311 --> @catthehacker commented on GitHub (Mar 30, 2022): https://github.com/actions/runner/blob/408d6c579c36f0eb318acfdafdcbafc872696501/src/Runner.Worker/Container/DockerCommandManager.cs#L143 https://github.com/actions/runner/blob/408d6c579c36f0eb318acfdafdcbafc872696501/src/Runner.Worker/Container/DockerCommandManager.cs#L209 https://github.com/actions/runner/blob/408d6c579c36f0eb318acfdafdcbafc872696501/src/Runner.Sdk/ProcessInvoker.cs#L272
Author
Owner

@KnisterPeter commented on GitHub (Mar 30, 2022):

Yes, that's what I've meant. It is true if it is executed in a runner.
From the docs linked above:

Always set to true when GitHub Actions is running the workflow. You can use this variable to differentiate when tests are being run locally or by GitHub Actions.

<!-- gh-comment-id:1082772473 --> @KnisterPeter commented on GitHub (Mar 30, 2022): Yes, that's what I've meant. It is true if it is executed in a runner. From the docs linked above: > Always set to true when GitHub Actions is running the workflow. You can use this variable to differentiate when tests are being run locally or by GitHub Actions.
Author
Owner

@kevcube commented on GitHub (Apr 8, 2022):

@KnisterPeter IMO setting this to true makes sense.

act is for simulating GitHub Actions workflow runs. If someone is checking $GITHUB_ACTIONS in an if-statement, act will want them to take the path for if it were true, in order to properly simulate GitHub actions.

<!-- gh-comment-id:1092684302 --> @kevcube commented on GitHub (Apr 8, 2022): @KnisterPeter IMO setting this to `true` makes sense. `act` is for simulating GitHub Actions workflow runs. If someone is checking `$GITHUB_ACTIONS` in an if-statement, `act` will want them to take the path for if it were `true`, in order to properly simulate GitHub actions.
Author
Owner

@KnisterPeter commented on GitHub (Apr 8, 2022):

So then. I'll close this.

<!-- gh-comment-id:1092686264 --> @KnisterPeter commented on GitHub (Apr 8, 2022): So then. I'll close this.
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#626
No description provided.