debian-mirror-gitlab/doc/user/project/integrations/github.md

62 lines
2.7 KiB
Markdown
Raw Normal View History

2020-10-24 23:57:45 +05:30
---
2022-11-25 23:54:43 +05:30
stage: Manage
2023-07-09 08:55:56 +05:30
group: Import and Integrate
2022-11-25 23:54:43 +05:30
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/product/ux/technical-writing/#assignments
2020-10-24 23:57:45 +05:30
---
2023-04-23 21:23:45 +05:30
# GitHub **(PREMIUM)**
2019-07-31 22:56:46 +05:30
2022-01-26 12:08:38 +05:30
You can update GitHub with pipeline status updates from GitLab.
2023-05-27 22:25:52 +05:30
The GitHub integration can help you if you use GitLab for CI/CD.
2019-07-31 22:56:46 +05:30
![Pipeline status update on GitHub](img/github_status_check_pipeline_update.png)
2022-01-26 12:08:38 +05:30
This project integration is separate from the [instance-wide GitHub integration](../import/github.md#mirror-a-repository-and-share-pipeline-status)
and is automatically configured when you import a [GitHub project](../../../integration/github.md).
## Configure the integration
2019-07-31 22:56:46 +05:30
2021-11-18 22:05:49 +05:30
This integration requires a [GitHub API token](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token)
2021-04-29 21:17:54 +05:30
with `repo:status` access granted.
Complete these steps on GitHub:
2019-07-31 22:56:46 +05:30
2021-04-29 21:17:54 +05:30
1. Go to your **Personal access tokens** page at <https://github.com/settings/tokens>.
1. Select **Generate new token**.
1. Under **Note**, enter a name for the new token.
2022-01-26 12:08:38 +05:30
1. Ensure `repo:status` is selected and select **Generate token**.
2021-04-29 21:17:54 +05:30
1. Copy the generated token to use in GitLab.
2019-07-31 22:56:46 +05:30
2021-04-29 21:17:54 +05:30
Complete these steps in GitLab:
2019-07-31 22:56:46 +05:30
2022-10-11 01:57:18 +05:30
1. On the top bar, select **Main menu > Projects** and find your project.
2022-01-26 12:08:38 +05:30
1. On the left sidebar, select **Settings > Integrations**.
2021-04-29 21:17:54 +05:30
1. Select **GitHub**.
2022-01-26 12:08:38 +05:30
1. Ensure the **Active** checkbox is selected.
1. In **Token**, paste the token you generated on GitHub.
1. In **Repository URL**, enter the path to your project on GitHub, such as `https://github.com/username/repository`.
1. Optional. To disable [static status check names](#static-or-dynamic-status-check-names), clear the **Enable static status check names** checkbox.
1. Optional. Select **Test settings**.
1. Select **Save changes**.
2019-07-31 22:56:46 +05:30
2022-10-11 01:57:18 +05:30
After configuring the integration, see [Pipelines for external pull requests](../../../ci/ci_cd_for_external_repos/index.md#pipelines-for-external-pull-requests)
2020-01-01 13:55:28 +05:30
to configure pipelines to run for open pull requests.
2021-12-11 22:18:48 +05:30
### Static or dynamic status check names
2019-07-31 22:56:46 +05:30
2022-03-02 08:16:31 +05:30
> [Changed](https://gitlab.com/gitlab-org/gitlab/-/issues/9931) in GitLab 12.4 to make static status check names the default behavior for new projects.
2022-01-26 12:08:38 +05:30
A status check name can be static or dynamic:
- **Static**: The hostname of your
GitLab instance is appended to the status check name.
2019-07-31 22:56:46 +05:30
2022-01-26 12:08:38 +05:30
- **Dynamic**: The branch name is appended
to the status check name.
2021-04-29 21:17:54 +05:30
2022-01-26 12:08:38 +05:30
The **Enable static status check names** option enables you to configure
required status checks in GitHub, which need a consistent (static) name to work correctly.
2019-07-31 22:56:46 +05:30
2022-01-26 12:08:38 +05:30
If you [disable this option](#configure-the-integration),
GitLab uses dynamic status check names instead.