Skip to content

Commit

Permalink
cr
Browse files Browse the repository at this point in the history
  • Loading branch information
malikchaya2 committed Dec 19, 2024
1 parent ab59427 commit 54879fd
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions docs/FAQ.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,13 @@ A few things may cause this issue:

After using the github.generate_token command to generate a token, you can then use it in a global git config with something like `git config --global url."https://x-access-token:${generated_token}@github.com/".insteadOf https://github.com/`. Evergreen will reset the global git config at the end of tasks (or for task groups, after the all the tasks in the task group tasks have finished).

##### I am expecting my app to be able to do something but when I generate a token and try to use it it doesn't work. How do I debug?
##### My generated token isn't working, how do I figure out why?

Here is a list of steps in recommended order:
Below is a recommended order for debugging steps:

- [Check if GitHub is down](https://www.githubstatus.com).
- If your current setup involves multiple steps or scripts, create a task that isolates the problem by only generating a token and immediately using it to do the operation you are trying to do. You can model it after the example [here](Project-Configuration/Project-Commands#githubgenerate_token). If it works in this isolated setting, debug efforts can be focused on yaml syntax and [token lifespan and scope](Project-Configuration/Project-Commands#token-lifespan).
- Double check the app permissions on the [project settings](Github-Integrations#dynamic-github-access-tokens) page to make sure that what you are trying to do is not restricted.
- Double check the permissions you specified in your project yaml when [generating the token](Project-Configuration/Project-Commands#githubgenerate_token) to make sure that what you are trying to do is not restricted.
- Use a script like [shell.exec](Project-Configuration/Project-Commands/shellexec) to print the length of the generated token to make sure it's not 0. If it is, delete your github app in [project settings](Github-Integrations#dynamic-github-access-tokens) and save it again to make sure that it was saved correctly. Make sure that you are saving github app ID or the github app key and not the Client ID.
- Test your app outside of Evergreen by generating a token and then using that token with the operation that doesn't work to make sure that a token generated by your app is powerful enough. While this is not officially supported by Evergreen, [Zack created a helpful script](https://github.com/10gen/employees/tree/master/home/zackary.santana/utils/github_dynamic_tokens) that can be used to generate a token on your machine. If you fail at this step, read the [github documentation](https://docs.github.com/en/rest/authentication/permissions-required-for-github-apps?apiVersion=2022-11-28) to figure out what permissions are needed for the thing you are trying to do and check in with the team that created the github app for you to double check that your app has those permissions. You can see all the available permissions [here](https://github.com/settings/apps/new). If your app has the right permissions but your token can't do the operation you expect on your machine, you may need to reach out to github for support.
- Check if GitHub is down.

0 comments on commit 54879fd

Please sign in to comment.