| --- |
| title: "GitHub" |
| description: > |
| GitHub Plugin |
| --- |
| |
| ## Summary |
| |
| This plugin collects GitHub data through [REST API](https://docs.github.com/en/rest/) and [GraphQL API](https://docs.github.com/en/graphql). It then computes and visualizes various DevOps metrics from the GitHub data, which helps tech leads, QA and DevOps engineers, and project managers to answer questions such as: |
| |
| - Is this month more productive than last? |
| - How fast do we respond to customer requirements? |
| - Was our quality improved or not? |
| |
| ## Supported Versions |
| |
| Available for GitHub Cloud. Check [this doc](https://devlake.apache.org/docs/Overview/SupportedDataSources#data-sources-and-data-plugins) for more details. |
| |
| ## Entities |
| |
| Check out the [GitHub entities](/Overview/SupportedDataSources.md#data-collection-scope-by-each-plugin) collected by this plugin. |
| |
| ## Data Refresh Policy |
| |
| Check out the [data refresh policy](/Overview/SupportedDataSources.md#github) of this plugin. |
| |
| ## Metrics |
| |
| Metrics that can be calculated based on the data collected from GitHub: |
| |
| - [Requirement Count](/Metrics/RequirementCount.md) |
| - [Requirement Lead Time](/Metrics/RequirementLeadTime.md) |
| - [Requirement Delivery Rate](/Metrics/RequirementDeliveryRate.md) |
| - [Requirement Granularity](/Metrics/RequirementGranularity.md) |
| - [Bug Age](/Metrics/BugAge.md) |
| - [Bug Count per 1k Lines of Code](/Metrics/BugCountPer1kLinesOfCode.md) |
| - [Incident Age](/Metrics/IncidentAge.md) |
| - [Incident Count per 1k Lines of Code](/Metrics/IncidentCountPer1kLinesOfCode.md) |
| - [Commit Count](/Metrics/CommitCount.md) |
| - [Commit Author Count](/Metrics/CommitAuthorCount.md) |
| - [Added Lines of Code](/Metrics/AddedLinesOfCode.md) |
| - [Deleted Lines of Code](/Metrics/DeletedLinesOfCode.md) |
| - [PR Count](/Metrics/PRCount.md) |
| - [PR Cycle Time](/Metrics/PRCycleTime.md) |
| - [PR Coding Time](/Metrics/PRCodingTime.md) |
| - [PR Pickup Time](/Metrics/PRPickupTime.md) |
| - [PR Review Time](/Metrics/PRReviewTime.md) |
| - [PR Deploy Time](/Metrics/PRDeployTime.md) |
| - [PR Time To Merge](/Metrics/PRTimeToMerge.md) |
| - [PR Merge Rate](/Metrics/PRMergeRate.md) |
| - [PR Review Depth](/Metrics/PRReviewDepth.md) |
| - [PR Size](/Metrics/PRSize.md) |
| - [Build Count](/Metrics/BuildCount.md) |
| - [Build Duration](/Metrics/BuildDuration.md) |
| - [Build Success Rate](/Metrics/BuildSuccessRate.md) |
| - [DORA - Deployment Frequency](/Metrics/DeploymentFrequency.md) |
| - [DORA - Lead Time for Changes](/Metrics/LeadTimeForChanges.md) |
| - [DORA - Median Time to Restore Service](/Metrics/MTTR.md) |
| - [DORA - Change Failure Rate](/Metrics/CFR.md) |
| |
| ## Configuration |
| |
| - Configuring GitHub via [Config UI](/Configuration/GitHub.md) |
| - Configuring GitHub via Config UI's [advanced mode](/Configuration/AdvancedMode.md#1-github). |
| |
| ## API Sample Request |
| |
| You can trigger data collection by making a POST request to `/pipelines`. |
| |
| ``` |
| curl 'http://localhost:8080/pipelines' \ |
| --header 'Content-Type: application/json' \ |
| --data-raw ' |
| { |
| "name": "project1-BLUEPRINT", |
| "blueprintId": 1, |
| "plan": [ |
| [ |
| { |
| "plugin": "github", |
| "options": { |
| "connectionId": 1, |
| "scopeId": "384111310", |
| "transformationRules":{ |
| "deploymentPattern":"", |
| "productionPattern":"", |
| "issueComponent":"", |
| "issuePriority":"(high|medium|low)$", |
| "issueSeverity":"", |
| "issueTypeBug":"(bug)$", |
| "issueTypeIncident":"", |
| "issueTypeRequirement":"(feature|feature-request)$", |
| "prBodyClosePattern":"", |
| "prComponent":"", |
| "prType":"" |
| } |
| } |
| } |
| ] |
| ] |
| } |
| ' |
| ``` |
| |
| or |
| |
| ``` |
| curl 'http://localhost:8080/pipelines' \ |
| --header 'Content-Type: application/json' \ |
| --data-raw ' |
| { |
| "name": "project1-BLUEPRINT", |
| "blueprintId": 1, |
| "plan": [ |
| [ |
| { |
| "plugin": "github", |
| "options": { |
| "connectionId": 1, |
| "owner": "apache", |
| "repo": "incubator-devlake", |
| "transformationRules":{ |
| "deploymentPattern":"", |
| "productionPattern":"", |
| "issueComponent":"", |
| "issuePriority":"(high|medium|low)$", |
| "issueSeverity":"", |
| "issueTypeBug":"(bug)$", |
| "issueTypeIncident":"", |
| "issueTypeRequirement":"(feature|feature-request)$", |
| "prBodyClosePattern":"", |
| "prComponent":"", |
| "prType":"" |
| } |
| } |
| } |
| ] |
| ] |
| } |
| ' |
| ``` |
| |
| ## References |
| |
| - [references](/DeveloperManuals/DeveloperSetup.md#references) |