使用 Power BI 连接到 GitHubConnect to GitHub with Power BI

适用于 Power BI 的 GitHub 内容包允许你通过参与、问题、拉取请求和活动用户的相关数据,深入了解 GitHub 存储机制(也称为存储库)。The GitHub content pack for Power BI allows you to gain insights into a GitHub repository (also known as repo) with data around contributions, issues, pull requests and active users.

连接到 GitHub 内容包或进一步了解 Power BI 与 GitHub 集成Connect to the GitHub content pack or read more about the GitHub integration with Power BI.

备注

内容包要求 GitHub 帐户具有存储库的访问权限。The content pack requires the GitHub account to have access to the repo. 以下是有关要求的详细信息。More details on requirements below.

如何连接How to connect

  1. 选择左侧导航窗格底部的获取数据Select Get Data at the bottom of the left navigation pane.

  2. 服务框中,选择获取In the Services box, select Get.

  3. 选择“GitHub”>“获取”。Select GitHub > Get.

  4. 输入该存储库的存储库名称和存储库所有者。Enter the repository name and repository owner of the repo. 有关详细信息,请参阅下面的查找这些参数See details on finding these parameters below.

  5. 输入 GitHub 凭据(如果你已经登录浏览器,可跳过此步骤)。Enter your GitHub credentials (this step might be skipped if you are already signed in with your browser).
  6. 针对“验证方法”,选择“oAuth2”>“登录”。For Authentication Method, select oAuth2 > Sign In.
  7. 按照 Github 验证界面执行操作。Follow the Github authentication screens. 向适用于 Power BI 的 GitHub 内容包授予对 GitHub 数据的权限。Grant the GitHub for Power BI content pack permission to the GitHub data.

    这将把 GitHub 与 Power BI 连接到一起,并允许 Power BI 连接到数据。This connects Power BI with GitHub and allows Power BI to connect to the data. 数据会每天刷新一次。The data is refreshed once a day.

  8. 连接到存储库后,Power BI 会导入数据。After you connect to your repo, Power BI imports the data. 你将在左侧导航窗格中看到新的 GitHub 仪表板、报表和数据集。You see a new GitHub dashboard, report, and dataset in the left navigation pane. 新的项目会以黄色星号 * 标记。New items are marked with a yellow asterisk *.

下一步?What now?

包含的内容What's included

在 Power BI 中 GitHub 提供以下数据:The following data is available from GitHub in Power BI:

表名Table name 说明Description
参与Contributions 参与者表提供每周汇总的参与者所执行的总新增、删除和提交操作。The contributions table gives the total additions, deletions and commits authored by the contributor aggregated per week. 包括前 100 个参与者。The top 100 contributors are included.
问题Issues 列出所选存储库的所有问题,其中包含计算,如:解决问题的总时间和平均时间、未解决问题总数和已解决问题总数。List all issues for the selected repo and it contains calculations like total and average time to close an issue, Total open issues, Total closed issues. 存储库中没有任何问题时,此表为空。This table will be empty when there are no issues in the repo.
拉取请求Pull requests 此表包含此存储库和拉取请求者的所有拉取请求。This table contains all the Pull Requests for the repo and who pulled the request. 它也包含相关计算,如:有多少未解决、已解决和总的拉取请求、拉取这些请求花了多少时间,以及拉取请求所耗用的平均时间。It also contains calculations around how many open, closed and total pull requests, how long it took to pull the requests and how long the average pull request took. 存储库中没有任何问题时,此表为空。This table will be empty when there are no issues in the repo.
用户Users 下表提供了 GitHub 使用者或参与者的列表,他们针对所选的存储库进行参与、提出问题或解决拉取请求。This table provides a list of GitHub users or contributors who have made contributions, filed issues or solved Pull requests for the repo selected.
里程碑Milestones 它具有所选存储库的所有里程碑。It has all the Milestones for the selected repo.
DateTableDateTable 此表包含从今天开始推算的和过去多年的日期,可让你按日期分析 GitHub 数据。This tables contains dates from today and for years in the past that allow you to analyze your GitHub data by date.
ContributionPunchCardContributionPunchCard 此表可用作所选存储库的参与穿孔卡。This table can be used as a contribution punch card for the selected repo. 它会按一周中各天和一天中各小时来显示提交。It shows commits by day of week and hour of day. 此表未连接到模型中的其他表。This table is not connected to other tables in the model.
RepoDetailsRepoDetails 此表提供所选存储库的详细信息。This table provides details for the repo selected.

系统要求System requirements

  • 具有存储库访问权限的 GitHub。The GitHub account that has access to the repo.
  • 第一次登录期间授予给适用于 GitHub 的 Power BI 应用的权限。Permission granted to the Power BI for GitHub app during first login. 有关撤消访问权限的详细信息,请参阅下文。See details below on revoking access.
  • 具有足够可用的 API 调用以拉取和刷新数据。Sufficient API calls available to pull and refresh the data.

取消授权 Power BIDe-authorize Power BI

若要取消将 Power BI 连接到 GitHub 的授权,可以撤销 GitHub 中的访问权限。To de-authorize Power BI from being connected to your GitHub repo you can Revoke access in GitHub. 有关详细信息,请参阅 GitHub 帮助主题。For more details see this GitHub help topic.

查找参数Finding parameters

你可以通过查看 GuiHub 本身的存储库来确定所有者和存储库:You can determine the owner and repository by looking at the repository in GitHub itself:

第一部分“Azure”是所有者,第二部分“azure-sdk-for-pho”是存储库本身。The first part "Azure" is the owner and the second part "azure-sdk-for-php" is the repository itself. 将在存储库的 URL 中看到这两个相同的项目:You see these same two items in the URL of the repository:

<https://github.com/Azure/azure-sdk-for-php> .

故障排除Troubleshooting

如有必要,可以验证你的 GitHub 凭据。If necessary, you can verify your GitHub credentials.

  1. 在另一个浏览器窗口中,转到 GitHub 网站并登录到 GitHub。In another browser window, go to the GitHub web site and log in to GitHub. 将在 GitHub 网站的右上角看到你已登录。You can see you’re logged in, in the upper-right corner of the GitHub site.
  2. 在 GitHub 中,导航到你计划要在 Power BI 中访问的存储库的 URL。In GitHub, navigate to the URL of the repo you plan to access in Power BI. 例如:https://github.com/dotnet/corefx。For example: https://github.com/dotnet/corefx.
  3. 返回到 Power BI,尝试连接到 GitHub。Back in Power BI, try connecting to GitHub. 在“配置 GitHub”对话框中,使用相同存储库的存储库名称和存储库所有者。In the Configure GitHub dialog box, use the names of the repo and repo owner for that same repo.

后续步骤Next steps