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

Initial commit failed with Error: Process completed with exit code 128. #70

Closed
tanjuntao opened this issue May 7, 2022 · 15 comments
Closed

Comments

@tanjuntao
Copy link

I followed the instructions in the README but the GitHub workflow failed. Here is some information.

My personal access token permissions

image

Step: generate images

Run python3 --version
Python 3.8.12
A path returned 202. Retrying...
A path returned 202. Retrying...
A path returned 202. Retrying...
A path returned 202. Retrying...
A path returned 202. Retrying...
A path returned 202. Retrying...
A path returned [20](https://github.com/tanjuntao/github-stats/runs/6331838497?check_suite_focus=true#step:6:20)2. Retrying...
A path returned 202. Retrying...
A path returned 202. Retrying...
A path returned 202. Retrying...
A path returned 202. Retrying...
A path returned 202. Retrying...
A path returned 202. Retrying...
A path returned 202. Retrying...
A path returned 202. Retrying...
A path returned 202. Retrying...
A path returned 202. Retrying...
A path returned 202. Retrying...
A path returned 202. Retrying...
A path returned 202. Retrying...
A path returned 202. Retrying...
A path returned 202. Retrying...
A path returned 202. Retrying...
A path returned 202. Retrying...
A path returned 202. Retrying...
A path returned 202. Retrying...
A path returned 202. Retrying...
A path returned 202. Retrying...
A path returned 202. Retrying...
A path returned 202. Retrying...
A path returned 202. Retrying...
A path returned 202. Retrying...
A path returned 202. Retrying...
A path returned 202. Retrying...
A path returned 202. Retrying...
A path returned 202. Retrying...
A path returned 202. Retrying...
A path returned 202. Retrying...
A path returned 202. Retrying...
A path returned 202. Retrying...
A path returned 202. Retrying...
A path returned 202. Retrying...
A path returned 202. Retrying...
A path returned 202. Retrying...
A path returned 202. Retrying...
A path returned 202. Retrying...
A path returned 202. Retrying...
A path returned 202. Retrying...
A path returned 202. Retrying...
A path returned 202. Retrying...
A path returned 202. Retrying...
A path returned 202. Retrying...
A path returned 202. Retrying...
A path returned 202. Retrying...
A path returned 202. Retrying...
A path returned 202. Retrying...
A path returned 202. Retrying...
A path returned 202. Retrying...
A path returned 202. Retrying...
A path returned 202. Retrying...
There were too many 202s. Data for this repository will be incomplete.

Step: commit to the repo

Run git config --global user.name "jstrieb/github-stats"
[master adc985c] Update generated files
 2 files changed, 33 insertions(+), [12](https://github.com/tanjuntao/github-stats/runs/6331838497?check_suite_focus=true#step:7:12)3 deletions(-)
remote: Permission to tanjuntao/github-stats.git denied to github-actions[bot].
fatal: unable to access 'https://github.com/tanjuntao/github-stats/': The requested URL returned error: 403
Error: Process completed with exit code 128.

I don't get where the problem comes from, would you please provide some suggestions?

@jstrieb
Copy link
Owner

jstrieb commented May 7, 2022

Hi @tanjuntao, thanks for taking the time to open this issue!

I have not seen this before, and do not have an answer off the top of my head. What is interesting is that I don't believe the final commit step actually uses your personal access token, so I don't think permissions for that are an issue. Have you tried re-running the action (or waiting until its next automatic run)? I'm curious if this is a fluke, or something that keeps happening.

@luchaoqi
Copy link

luchaoqi commented May 7, 2022

I am having the same issue here and re-running workflow doesn't work - will wait for the next automatic run to see if it still happens.

@tanjuntao
Copy link
Author

Yes, I did re-run the action several times and each time I failed at the git commit step and got the same error message.

@briancpark
Copy link

I just started trying to use this as a new user. I see the same errors happening on my end as well ;(.

jstrieb added a commit that referenced this issue May 8, 2022
@jstrieb
Copy link
Owner

jstrieb commented May 8, 2022

Hi all, thanks for chiming in! I figured out what the problem is.

It seems like GitHub changed the default permissions of the GITHUB_TOKEN environment variable available within Actions. I have just updated the Actions workflow to explicitly use write permissions for the token, so if you use the latest version of the actions workflow, it should work with no further changes. There is also a way to change the default token permissions from the repository settings.

In other words, this is fixed in the latest version of the repo. But for you in this thread who already have a stale copy, there are two ways to fix this, and you can pick either one:

  • Regenerate a copy of the repository from the template and follow the steps with the latest version of the repo.
    • Alternatively, copy the newly-updated .github/workflows/main.yml file into your version of that file in your copy of this repository.
  • Change the default permission of the token (without modifying the workflow).
    1. Go to repository Settings > Actions > General (available here, where username is replaced with your username: https://github.com/username/github-stats/settings/actions).
    2. Change the "Workflow Permissions" to "read and write permission"
      image

Thanks again for reporting this issue! I would never have known about it otherwise, and now it's fixed for everyone 😁

@jstrieb jstrieb closed this as completed May 8, 2022
@jstrieb jstrieb mentioned this issue May 8, 2022
@luchaoqi
Copy link

luchaoqi commented May 9, 2022

The problem is solved but I got another issue same as #21 and #35 using the manual run afterward.

Run git config --global user.name "jstrieb/github-stats"
[master 87bd302] Update generated files
 2 files changed, 72 insertions(+), 63 deletions(-)
To https://github.com/luchaoqi/github-stats
 ! [rejected]        master -> master (fetch first)
error: failed to push some refs to 'https://github.com/luchaoqi/github-stats'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
Error: Process completed with exit code 1.

@tanjuntao
Copy link
Author

I got exactly the same problem as you, I solved it by just deleting my old github-stats repo and generated a new one from scratch, this worked for me. 🤣

@briancpark
Copy link

Hmm. For me, the auto update of generating the file again failed.... with the same error as before, even though I repulled the updated template.

@luchaoqi
Copy link

luchaoqi commented May 9, 2022

I tried totally deleting the repo and reconfiguring it again - solve the problem as of now for me.

@tanjuntao
Copy link
Author

@briancpark Did you still fail at the initial commit step after re-generating an updated repo? If your problem is same as #30, you can just wait for some minutes and run the failed job again and it will work.

@briancpark
Copy link

No, I successfully generated after re-generating an updated repo. That initial run took under 5 minutes. I changed a few env variables and I waited over an hour, but it's still hanging on the next runs after that ;(

@tanjuntao
Copy link
Author

Have no idea about that. From the main.yml under the .github/workflows/, the supported env variables are

      env:
        ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }}
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        EXCLUDED: ${{ secrets.EXCLUDED }}
        EXCLUDED_LANGS: ${{ secrets.EXCLUDED_LANGS }}
        EXCLUDE_FORKED_REPOS: true

Maybe you could check the names and values of your env variables first, and if there are no problems, then just wait for the author to give a suggestion.

*Note: the values of env variables should be separated by a comma (if more than two), because they are split by Python split() function in generated_images.py:

    exclude_repos = os.getenv("EXCLUDED")
    excluded_repos = (
        {x.strip() for x in exclude_repos.split(",")} if exclude_repos else None
    )
    exclude_langs = os.getenv("EXCLUDED_LANGS")
    excluded_langs = (
        {x.strip() for x in exclude_langs.split(",")} if exclude_langs else None
    )

@briancpark
Copy link

briancpark commented May 9, 2022

Thanks for the suggestion. All I did was add html,ipynb to EXCLUDED_LANGS. But seems like undoing it doesn't fix the problem. I'll try to redo the whole process of deleting and creating a new repo later.

Edit: There was no error at all. It just took a really long time to index my repositories I guess. Workflow takes around 4 hours. Other than the long wait, everything is running smoothly for me :)

@luchaoqi
Copy link

Thanks for the suggestion. All I did was add html,ipynb to EXCLUDED_LANGS. But seems like undoing it doesn't fix the problem. I'll try to redo the whole process of deleting and creating a new repo later.

Edit: There was no error at all. It just took a really long time to index my repositories I guess. Workflow takes around 4 hours. Other than the long wait, everything is running smoothly for me :)

Does html,ipynb work for you? Only html works in my case.

@seyfer
Copy link

seyfer commented Apr 21, 2024

this setting change as in the comment #70 (comment) actually solves an issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants