GitHub project integration

原文:https://docs.gitlab.com/ee/user/project/integrations/github.html

GitHub project integration

在 GitLab Premium 10.6 中引入 .

GitLab 提供了一个集成,用于更新 GitHub 上的管道状态. 如果仅将 GitLab 用于 CI / CD,这将特别有用.

此项目集成与实例范围的 GitHub 集成分开,并且在GitHub import上自动配置.

Pipeline status update on GitHub

Configuration

Complete these steps on GitHub

此集成需要GitHub API 令牌,并授予repo:status访问权限:

  1. 转到https://github.com/settings/tokens 上的 “个人访问令牌”页面.
  2. 点击”生成新令牌”
  3. 确保选中repo:status并单击” Generate token”
  4. 复制生成的令牌以在 GitLab 上使用

Complete these steps on GitLab

  1. Navigate to the project you want to configure.
  2. 导航到” 集成”页面
  3. 点击” GitHub”.
  4. 确保启用了活动切换.
  5. 粘贴您在 GitHub 上生成的令牌
  6. 输入您在 GitHub 上的项目的路径,例如https://github.com/username/repository
  7. (可选)取消选中” 静态状态检查名称”复选框以禁用静态状态检查名称.
  8. 保存或选择单击”测试设置”.

配置完集成后,请参阅外部请求请求的管道,以配置要为打开请求请求运行的管道.

Static / dynamic status check names

版本历史

  • 在 GitLab 11.5 中引入:使用静态检查名称作为选择加入选项.
  • 在 GitLab 12.4 中 ,静态状态检查名称是新项目的默认行为.

This makes it possible to mark these status checks as Required on GitHub. 这样就可以在 GitHub 上将这些状态检查标记为” 必需 “. With Static status check names enabled on the integration page, your GitLab instance host name is going to be appended to a status check name, whereas in case of dynamic status check names, a branch name is going to be appended. 在集成页面上启用了静态状态检查名称后 ,您的 GitLab 实例主机名将被附加到状态检查名称中,而在动态状态检查名的情况下将被添加分支名称.

Configure GitHub Project Integration