Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Git checkout requires github token #233

Closed
ovitente opened this issue May 13, 2020 · 14 comments · Fixed by #680
Closed

Git checkout requires github token #233

ovitente opened this issue May 13, 2020 · 14 comments · Fixed by #680
Labels
area/cli Relating to the cli kind/bug Something isn't working meta/resolved Issue has been fixed or valid solution has been provided (not workaround)

Comments

@ovitente
Copy link

Hello

OS: MacOS Catalina
GIT: 2.26.2 (installed through brew and added /usr/local/bin/ to $PATH)

My workflow has this step

    - uses: actions/checkout@v2
      name: GIT | Checkout
      with:
        ref: ${{ github.ref }} 

As result with act can't continue due this error that i can't handle, because there are no info in --help about it.

[STAGE | DEPLOY/CI | api | DEPLOY]   ?  ::group::Getting Git version info
| Working directory is '/github/workspace'
[STAGE | DEPLOY/CI | api | DEPLOY]   ? ::endgroup::
| Deleting the contents of '/github/workspace'
| The repository will be downloaded using the GitHub REST API
| To create a local Git repository instead, add Git 2.18 or higher to the PATH
| Downloading the archive
| Parameter token or opts.auth is required
| Waiting 11 seconds before trying again
| Downloading the archive
| Parameter token or opts.auth is required
| Waiting 17 seconds before trying again
Error: context canceled

Questions:

  • Why act is trying to get reach into remote private repo instead of using local fresh pulled copy?
  • What should i put into opts.auth file and where to put it to get act working?
@gimmyxd
Copy link

gimmyxd commented May 13, 2020

What should i put into opts.auth file and where to put it to get act working?

@ovitente i got past a similar issue by using GITHUB_TOKEN=my_token act command

@cplee cplee added area/cli Relating to the cli kind/bug Something isn't working labels May 13, 2020
@ovitente
Copy link
Author

ovitente commented May 14, 2020

@gimmyxd Unfortunately I am receiving the same error.
GITHUB_TOKEN=my_token act
or

export GITHUB_TOKEN=my_token
act

Not working :(

image

@Magnum97
Copy link

Magnum97 commented Jun 5, 2020

I found that if one goes to Settings and Personal Access Tokens, and generate a new token. Make sure to remove all access except user and use this key in place of ${ secrets.GITHUB_TOKEN ) it solved my issue with this exact error.

Edit:
Felt negligent not to mention that you should not commit this to your repository. I created a local branch to use it in for testing.

@github-actions
Copy link
Contributor

github-actions bot commented Aug 5, 2020

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

@github-actions github-actions bot added the stale label Aug 5, 2020
@cplee cplee removed the stale label Aug 5, 2020
@1oglop1
Copy link

1oglop1 commented Sep 27, 2020

Thanks all above for the workaround, I just hit the same issue.

I could clone my own repo but when I tried to clone another public repo I've got an error. It may be have to do something with this: https://github.com/actions/checkout#checkout-multiple-repos-private
even though the bolt-python repo is public.

    - name: Checkout
      uses: actions/checkout@v2
      with:
        path: main
    - name: Checkout bolt-python repo
      uses: actions/checkout@v2
      with:
        repository: slackapi/bolt-python
        path: bolt-python

It would be good to mention this in README of act project or use GitHub token as a requirement by default.

@ovitente
Copy link
Author

ovitente commented Oct 20, 2020

Working solution for token on current version, - 0.2.16

cd your_local_repo_directory
export GITHUB_TOKEN=YOUR_TOKEN
act -w .github/workflow/dev.yaml

cloudcosmonaut added a commit to readefries/IBAN-Helper that referenced this issue Apr 14, 2021
cloudcosmonaut added a commit to readefries/IBAN-Helper that referenced this issue Apr 14, 2021
@yoanne2x
Copy link

yoanne2x commented May 7, 2021

Hi, I would like to re-open this issue.

I have just installed act on my local mac, tried to run it against a private rep and I have the same issue as above:

[CI/Deployment] ❗ ::error::Input required and not supplied: token
[CI/Deployment] ❌ Failure - actions/checkout@v2

If I manually add the token in the action within the job with my personal generated token, it will work.

If I try to use the export GITHUB_TOKEN=<> and execute act, I get the same error.

is there something that I am missing?

kind regards

@catthehacker
Copy link
Member

You should pass GITHUB_TOKEN as secret, act -s GITHUB_TOKEN=[insert token or leave blank for secure input]

@torbjornvatn
Copy link
Contributor

You should pass GITHUB_TOKEN as secret, act -s GITHUB_TOKEN=[insert token or leave blank for secure input]

@catthehacker Maybe we should make this clear in the README, because there it's only mentioned as a something you need to use GHE

@YuMuuu
Copy link

YuMuuu commented May 28, 2021

I encounted the same problem.
#233 (comment)

Why need the gtihub token to run locally ??

@catthehacker
Copy link
Member

@YuMuuu please see #678

@YuMuuu
Copy link

YuMuuu commented May 28, 2021

@catthehacker Thanks for the information! I I understood it.

@merlinstardust
Copy link

Since the GITHUB_TOKEN is required, act should check if it's passed in and if it's not there, act should immediately alert the user to its necessity.

Also, the README does not mention that this is required

@catthehacker
Copy link
Member

@merlinpatt please see #678

@catthehacker catthehacker added the meta/resolved Issue has been fixed or valid solution has been provided (not workaround) label Aug 17, 2021
@catthehacker catthehacker linked a pull request Aug 17, 2021 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/cli Relating to the cli kind/bug Something isn't working meta/resolved Issue has been fixed or valid solution has been provided (not workaround)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

10 participants