简体   繁体   English

GitHub 应用程序和 GitHub 的 REST API 之间有什么区别?

[英]What is the difference between a GitHub App and the REST API for GitHub?

What is the difference between a GitHub App and the REST API for GitHub? GitHub 应用程序和 GitHub 的 REST API 之间有什么区别? Why would you need a GitHub App if you can just use the REST API, without setting any environment up?如果您可以只使用 REST API,而无需设置任何环境,为什么还需要 GitHub 应用程序?

The REST API should just be a collection of endpoints that accept a POST along with access tokens. REST API 应该只是接受 POST 和访问令牌的端点的集合。 But the GitHub App requires cloning an entire repo written in Ruby, that has nothing to do with my app.但是 GitHub 应用程序需要克隆用 Ruby 编写的整个存储库,这与我的应用程序无关。

I am not looking for users to integrate with my repo, I want them to be able to connect their own repo to the application.我不是在寻找用户与我的 repo 集成,我希望他们能够将他们自己的 repo 连接到应用程序。

But the GitHub App requires cloning an entire repo written in Ruby, that has nothing to do with my app.但是 GitHub 应用程序需要克隆用 Ruby 编写的整个存储库,这与我的应用程序无关。

I don't believe this is true.我不相信这是真的。

GitHub Apps make the process of integrating 3rd party tools into your GitHub repositories smoother. GitHub 应用程序使将 3rd 方工具集成到 GitHub 存储库的过程更加顺畅。

GitHub Apps are installed by organizations and granted access to specific repositories via GitHub. GitHub 应用程序由组织安装,并被授予通过 GitHub 访问特定存储库的权限。 For example, CodeClimate is a tool which performs checks on pull requests.例如,CodeClimate 是一个对拉取请求执行检查的工具。 Rather than granting them OAuth access to my repositories, I can install the CodeClimate GitHub App on my organization and configure which repositories they have access to.我可以在我的组织上安装CodeClimate GitHub 应用程序并配置他们有权访问的存储库,而不是授予他们对我的存储库的 OAuth 访问权限。 I can see all the apps installed and what their permissions are.我可以看到所有已安装的应用程序及其权限。

Note that "installing" a GitHub App does not install any code.请注意,“安装” GitHub 应用程序不会安装任何代码。 "Installing" gives the app permissions for the service to access your organization and repos. “安装”为该服务授予应用程序访问您的组织和存储库的权限。 A GitHub App is a wrapper around an existing service. GitHub 应用程序是现有服务的包装器。

If you want users to connect their repos to your application, consider a GitHub App.如果您希望用户将他们的存储库连接到您的应用程序,请考虑使用 GitHub 应用程序。


This is covered in About apps .这在关于应用程序中有介绍

An OAuth App acts as a GitHub user, whereas a GitHub App uses its own identity when installed on an organization or on repositories within an organization. OAuth 应用程序充当 GitHub 用户,而 GitHub 应用程序在安装在组织或组织内的存储库上时使用自己的身份。

GitHub Apps are the officially recommended way to integrate with GitHub because they offer much more granular permissions to access data, but GitHub supports both OAuth Apps and GitHub Apps. GitHub 应用程序是官方推荐的与 GitHub 集成的方式,因为它们提供了更精细的数据访问权限,但 GitHub 支持 OAuth 应用程序和 GitHub 应用程序。

GitHub Apps are first-class actors within GitHub. GitHub 应用程序是 GitHub 中的一流参与者。 A GitHub App acts on its own behalf, taking actions via the API directly using its own identity, which means you don't need to maintain a bot or service account as a separate user. GitHub 应用程序代表自己采取行动,直接使用自己的身份通过 API 采取行动,这意味着您无需将机器人或服务帐户作为单独的用户进行维护。

GitHub Apps can be installed directly on organizations and user accounts and granted access to specific repositories. GitHub 应用程序可以直接安装在组织和用户帐户上,并被授予对特定存储库的访问权限。 They come with built-in webhooks and narrow, specific permissions.它们带有内置的 webhook 和狭窄的特定权限。 When you set up your GitHub App, you can select the repositories you want it to access.设置 GitHub 应用程序时,您可以选择希望它访问的存储库。 For example, you can set up an app called MyGitHub that writes issues in the octocat repository and only the octocat repository.例如,您可以设置一个名为 MyGitHub 的应用程序,该应用程序在 octocat 存储库中写入问题,并且仅在 octocat 存储库中写入。 To install a GitHub App, you must be an organization owner or have admin permissions in a repository.要安装 GitHub 应用程序,您必须是组织所有者或在仓库中具有管理员权限。

GitHub Apps are applications that need to be hosted somewhere. GitHub 应用程序是需要托管在某处的应用程序。 For step-by-step instructions that cover servers and hosting, see "Building Your First GitHub App."有关涵盖服务器和托管的分步说明,请参阅 “构建您的第一个 GitHub 应用程序”。

Differences between GitHub Apps and OAuth Apps has a complete breakdown. GitHub 应用程序和 OAuth 应用程序之间的差异有一个完整的细分。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM