-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add GitHub PRs to the Static Analysis integrations (#20981)
* Add GitHub PRs to the integrations * Update _index.md * Update content/en/continuous_integration/static_analysis/_index.md Co-authored-by: Mark Azer <[email protected]> * Update _index.md * Write feature overview for GitHub source code management * Sketch in content outline * Add page to the TOC * Add section on configuring a GitHub App * Add product shot * Update product screenshot * Flesh out GitHub App instructions * Finish first draft of instructions * Update content/en/static_analysis/github_source_code_management.md Co-authored-by: Mark Azer <[email protected]> * Update content/en/static_analysis/github_source_code_management.md Co-authored-by: Mark Azer <[email protected]> * Update content/en/static_analysis/github_source_code_management.md Co-authored-by: Mark Azer <[email protected]> * Update content/en/static_analysis/github_source_code_management.md Co-authored-by: Mark Azer <[email protected]> * Update content/en/static_analysis/github_source_code_management.md Co-authored-by: Mark Azer <[email protected]> * Integrate feedback * Rename file * Update URL * Integrate feedback * Update identifier * Update _index.md * Tweak instructions * Integrate feedback * Update content/en/static_analysis/github_pull_requests.md Co-authored-by: Austin Lai <[email protected]> * Update content/en/static_analysis/github_pull_requests.md Co-authored-by: Austin Lai <[email protected]> * Update content/en/static_analysis/github_pull_requests.md Co-authored-by: Austin Lai <[email protected]> * Update content/en/static_analysis/github_pull_requests.md Co-authored-by: Austin Lai <[email protected]> * Update content/en/static_analysis/github_pull_requests.md Co-authored-by: Austin Lai <[email protected]> * Update content/en/static_analysis/github_pull_requests.md Co-authored-by: Austin Lai <[email protected]> * Update content/en/static_analysis/github_pull_requests.md Co-authored-by: Austin Lai <[email protected]> * Update content/en/static_analysis/github_pull_requests.md Co-authored-by: Austin Lai <[email protected]> * Update content/en/static_analysis/github_pull_requests.md Co-authored-by: Austin Lai <[email protected]> * Update content/en/static_analysis/github_pull_requests.md Co-authored-by: Austin Lai <[email protected]> * Spacing Nit --------- Co-authored-by: Mark Azer <[email protected]> Co-authored-by: Austin Lai <[email protected]>
- Loading branch information
1 parent
d4d7a41
commit 498e078
Showing
9 changed files
with
88 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
--- | ||
title: GitHub Pull Requests | ||
kind: documentation | ||
description: Learn how to use Static Analysis in GitHub pull requests. | ||
further_reading: | ||
- link: "/integrations/github/" | ||
tag: "Documentation" | ||
text: "Learn about the GitHub integration" | ||
- link: "/static_analysis/" | ||
tag: "Documentation" | ||
text: "Learn about Static Analysis" | ||
--- | ||
|
||
## Overview | ||
|
||
Static Analysis can automatically flag rule violations in pull requests on GitHub. To configure the [GitHub integration][2] to include Static Analysis features, see [the setup instructions](#set-up-static-analysis-for-github-pull-requests). | ||
|
||
During code reviews on GitHub, the integration checks for Static Analysis violations in pull requests for repos that have at least one ruleset applied. Violations are flagged with a review comment on the relevant line of code. | ||
|
||
{{< img src="ci/static-analysis-pr-comment-example.png" alt="Example of a Static Analysis comment on a pull request" style="width:90%;" >}} | ||
|
||
The comment includes the name, ID, severity, category, and description of the violation. Certain violations also include suggested changes that can be applied directly in the GitHub UI. | ||
|
||
## Set up Static Analysis for GitHub pull requests | ||
|
||
### Enable Static Analysis on Datadog | ||
|
||
To use Datadog Static Analysis, add the appropriate configuration files to your repository, as described in the [setup instructions][1]. | ||
|
||
### Configure a GitHub App | ||
|
||
To use Static Analysis on GitHub, you can do one of the following: | ||
|
||
- Create a GitHub App in Datadog. | ||
- Update an existing GitHub App, if you have already created one in Datadog. | ||
|
||
The permissions you grant to the GitHub App determine which [GitHub integration][2] features are available for setup. | ||
|
||
#### Create and install a GitHub App | ||
|
||
1. In Datadog, navigate to [**Integrations > GitHub Applications > Add New GitHub Application**][3]. | ||
1. Fill out any required details, such as the GitHub organization name. | ||
1. Under **Select Features**, check the **Static Analysis: Pull Request Review Comments** box. | ||
1. Under **Edit Permissions**, verify that the **Pull Requests** permission is set to **Read & Write**. | ||
1. Click **Create App in GitHub**. | ||
1. Enter a name for your app, and submit it. | ||
1. Click **Install GitHub App**. | ||
1. Choose which repositories the app should be installed into, then click **Install & Authorize**. | ||
|
||
{{< img src="ci/static-analysis-install-github-app.png" alt="GitHub App installation screen" style="width:50%;" >}} | ||
|
||
#### Update an existing GitHub App | ||
|
||
1. In Datadog, navigate to [**Integrations > GitHub Applications**][5], and search for the GitHub App you want to use for Static Analysis. | ||
{{< img src="ci/static-analysis-existing-github-app.png" alt="Example of a Static Analysis comment on a pull request" style="width:90%;" >}} | ||
1. On the **Features** tab, look at the **Static Analysis: Pull Request Comments** section to determine whether your GitHub App needs additional permissions. If so, click **Update permissions in GitHub** to edit the app settings. | ||
1. Under **Repository permissions**, set the **Pull Requests** access to **Read and write**. | ||
{{< img src="ci/static-analysis-pr-read-write-permissions.png" alt="The dropdown for the pull request read and write permission" style="width:90%;" >}} | ||
1. Under the **Subscribe to events** heading, check the **Pull request** box. | ||
{{< img src="ci/static-analysis-pr-review-comment.png" alt="The checkbox for the pull request review comment permission" style="width:90%;" >}} | ||
|
||
### Enable Static Analysis PR comments for your repositories | ||
|
||
1. In Datadog, navigate to [**CI Settings** > **Static Analysis Settings**][4]. | ||
1. Click the toggle switch next to a given repository to enable **GitHub Comments**. In the example below, comments are enabled for the `demo-static-analysis-gates` repository. | ||
|
||
{{< img src="ci/static-analysis-github-comments.png" alt="Example of a Static Analysis comment on a pull request" style="width:100%;" >}} | ||
|
||
## Further Reading | ||
|
||
{{< partial name="whats-next/whats-next.html" >}} | ||
|
||
[1]: /static_analysis#setup | ||
[2]: /integrations/github/ | ||
[3]: https://app.datadoghq.com/integrations/github/add | ||
[4]: https://app.datadoghq.com/ci/settings/static-analysis | ||
[5]: https://app.datadoghq.com/integrations/github/configuration |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.