GitHub Issues
Our GitHub Issues integration enables you to turn issues flagged in Code Climate into GitHub Issues with one quick click. For example, on your Feed page, mouse over a smell and click the "ticket" icon.
- In order for Code Climate to have the appropriate permissions to post to your repository's issues, a GitHub OAuth token must be generated. Browse to the following location in GitHub: https://github.com/settings/tokens.
Ensure you are logged into GitHub as a user that has access and sufficient privileges to the repository. Note that Code Climate will open the issue as the user that generates the token.
- Click Generate new token.
Note: GitHub may prompt for your password before allowing you to proceed.
- Name the token (anything you like, as long as no other GitHub token currently shares this name). Ensure that the
repo
scope is checked. Click Generate Token.
- Click the "copy to clipboard" button.
- In a new browser window, navigate to your Code Climate Dashboard.
- Mouse over your repository's name and click Settings.
- Select the Integrations tab.
- Next to GitHub Issues, click Set Up.
- Paste the OAuth token in the OAuth Token field.
- Enter the project name in the Project field. This is the project name on GitHub. For example, user/myapp.
- Enter any labels in the Labels field. These labels will be associated with any issues created by Code Climate.
- Ensure Active is checked and click Save.
- To verify the GitHub data is valid, click Test Service (this will post a test issue to your repository). If a green message appears at the top of the screen, all is well. If a red error message is displayed, see Troubleshooting below.
Troubleshooting
- If you are seeing a red error message after clicking Test Service:
- Ensure there are no leading or trailing spaces around the token that you provided to Code Climate.
- Ensure you generated the token as a GitHub user that has access to the repository. If you have multiple GitHub users, double-check that you're logged into GitHub as the appropriate user.
- If your repo is a fork of another repo, make sure that you've enabled the Issues feature for your repo. Otherwise, you'll get a 404 from the integration:
Does Code Climate require Read/Write access to my GitHub repositories?
Code Climate requests the following GitHub permissions:
-
user:email
- requested when signing up using GitHub. An email address is required to create a Code Climate user. -
public_repo
- requested when adding a public repo to Code Climate. This access allow us to install a read-only SSH key, set up a webhook, and write commit statuses to public repos. -
repo
- requested when adding a private repository to Code Climate. This access allow us to install a read-only SSH key, set up a webhook, and write commit statuses to private repos.
The repo
and public_repo
scopes grant read and write access to code. While we will never write code to your repository, currently these OAuth scopes are the most narrow that GitHub supports for our use case (there is no repo:read
e.g.).
GitHub Integrations
We have two GitHub integrations: one for GitHub pull requests and another for GitHub Issues. Since both integrations require you to create a GitHub personal access token, ensure that the token does not have read/write access:
-
GitHub Pull Requests: The token should be generated by any user that has GitHub permissions to access the repository (it is not necessary to generate the token as a GitHub machine user). When generating the token, ensure that only the repo:status scope is selected.
-
GitHub Issues: The token should be generated by a GitHub machine user that has read-only access to the repository. When generating the token, ensure the repo scope is selected.
Updated almost 4 years ago