[GH-ISSUE #2749] Cannot supply GITHUB_TOKEN secret for actions separately from the token act uses #1245

Open
opened 2026-03-01 21:49:54 +03:00 by kerem · 0 comments
Owner

Originally created by @feynmanix on GitHub (May 7, 2025).
Original GitHub issue: https://github.com/nektos/act/issues/2749

Act version

act version 0.2.77

Feature description

I need to test how my GitHub workflows handle GITHUB_TOKEN, but it must not be a real token to prevent accidental damage. It is possible to supply a custom token value with -s GITHUB_TOKEN="gho_xxx". However, it makes act fail because it then tries to use the token to clone actions and fails with:

> act push -s GITHUB_TOKEN="gho_xxx"
INFO[0000] Using docker host 'unix:///var/run/docker.sock', and daemon socket 'unix:///var/run/docker.sock'
WARN  ⚠ You are using Apple M-series chip and you have not specified container architecture, you might encounter issues while running act. If so, try running it with '--container-architecture linux/amd64'. ⚠
INFO[0000] Start server on http://192.168.1.209:34567
WARN[0000] unable to get git ref: reference not found
WARN[0000] unable to get git revision: reference not found
[Python Tests/test] ⭐ Run Set up job
[Python Tests/test] 🚀  Start image=catthehacker/ubuntu:act-latest
[Python Tests/test]   🐳  docker pull image=catthehacker/ubuntu:act-latest platform= username= forcePull=true
[Python Tests/test] using DockerAuthConfig authentication for docker pull
[Python Tests/test]   🐳  docker create image=catthehacker/ubuntu:act-latest platform= entrypoint=["tail" "-f" "/dev/null"] cmd=[] network="host"
[Python Tests/test]   🐳  docker run image=catthehacker/ubuntu:act-latest platform= entrypoint=["tail" "-f" "/dev/null"] cmd=[] network="host"
[Python Tests/test]   🐳  docker exec cmd=[node --no-warnings -e console.log(process.execPath)] user= workdir=
[Python Tests/test]   ✅  Success - Set up job
[Python Tests/test] unable to get git ref: reference not found
[Python Tests/test] unable to get git revision: reference not found
[Python Tests/test] unable to get git ref: reference not found
[Python Tests/test] unable to get git revision: reference not found
[Python Tests/test] unable to get git ref: reference not found
[Python Tests/test] unable to get git revision: reference not found
[Python Tests/test]   ☁  git clone 'https://github.com/actions/setup-python' # ref=v5
[Python Tests/test] authentication required: Support for password authentication was removed on August 13, 2021.
Please see https://docs.github.com/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
[Python Tests/test] ⭐ Run Complete job
[Python Tests/test] unable to get git ref: reference not found
[Python Tests/test] unable to get git revision: reference not found
[Python Tests/test]   ✅  Success - Complete job
[Python Tests/test] 🏁  Job failed
Error: authentication required: Support for password authentication was removed on August 13, 2021.
Please see https://docs.github.com/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.

I would like to be able to specify the token for act to use and for the workflows to use separately. E.g., there could be a special option --github-token, or a special environment variable for this (e.g., ACT_GITHUB_TOKEN). The latter may be safer because it doesn't force the user to enter the token on the command line.

The relevant code seems to be root.go, where the token to use is configured, and git.go where it's used.

Originally created by @feynmanix on GitHub (May 7, 2025). Original GitHub issue: https://github.com/nektos/act/issues/2749 ### Act version act version 0.2.77 ### Feature description I need to test how my GitHub workflows handle GITHUB_TOKEN, but it must not be a real token to prevent accidental damage. It is possible to supply a custom token value with `-s GITHUB_TOKEN="gho_xxx"`. However, it makes act fail because it then tries to use the token to clone actions and fails with: ``` > act push -s GITHUB_TOKEN="gho_xxx" INFO[0000] Using docker host 'unix:///var/run/docker.sock', and daemon socket 'unix:///var/run/docker.sock' WARN ⚠ You are using Apple M-series chip and you have not specified container architecture, you might encounter issues while running act. If so, try running it with '--container-architecture linux/amd64'. ⚠ INFO[0000] Start server on http://192.168.1.209:34567 WARN[0000] unable to get git ref: reference not found WARN[0000] unable to get git revision: reference not found [Python Tests/test] ⭐ Run Set up job [Python Tests/test] 🚀 Start image=catthehacker/ubuntu:act-latest [Python Tests/test] 🐳 docker pull image=catthehacker/ubuntu:act-latest platform= username= forcePull=true [Python Tests/test] using DockerAuthConfig authentication for docker pull [Python Tests/test] 🐳 docker create image=catthehacker/ubuntu:act-latest platform= entrypoint=["tail" "-f" "/dev/null"] cmd=[] network="host" [Python Tests/test] 🐳 docker run image=catthehacker/ubuntu:act-latest platform= entrypoint=["tail" "-f" "/dev/null"] cmd=[] network="host" [Python Tests/test] 🐳 docker exec cmd=[node --no-warnings -e console.log(process.execPath)] user= workdir= [Python Tests/test] ✅ Success - Set up job [Python Tests/test] unable to get git ref: reference not found [Python Tests/test] unable to get git revision: reference not found [Python Tests/test] unable to get git ref: reference not found [Python Tests/test] unable to get git revision: reference not found [Python Tests/test] unable to get git ref: reference not found [Python Tests/test] unable to get git revision: reference not found [Python Tests/test] ☁ git clone 'https://github.com/actions/setup-python' # ref=v5 [Python Tests/test] authentication required: Support for password authentication was removed on August 13, 2021. Please see https://docs.github.com/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication. [Python Tests/test] ⭐ Run Complete job [Python Tests/test] unable to get git ref: reference not found [Python Tests/test] unable to get git revision: reference not found [Python Tests/test] ✅ Success - Complete job [Python Tests/test] 🏁 Job failed Error: authentication required: Support for password authentication was removed on August 13, 2021. Please see https://docs.github.com/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication. ``` I would like to be able to specify the token for act to use and for the workflows to use separately. E.g., there could be a special option `--github-token`, or a special environment variable for this (e.g., `ACT_GITHUB_TOKEN`). The latter may be safer because it doesn't force the user to enter the token on the command line. The relevant code seems to be [root.go](https://github.com/nektos/act/blob/324bab61f056e7e103b142b4c2f8b3b34421d764/cmd/root.go#L616), where the token to use is configured, and [git.go](https://github.com/nektos/act/blob/324bab61f056e7e103b142b4c2f8b3b34421d764/pkg/common/git/git.go#L260) where it's used.
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#1245
No description provided.