GitHub config flow (#21228)

Co-authored-by: Franck Nijhof <git@frenck.dev>
This commit is contained in:
Joakim Sørensen 2022-01-18 20:59:14 +01:00 committed by GitHub
parent f64f3245ad
commit 84dbd39892
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,8 +1,9 @@
--- ---
title: GitHub title: GitHub
description: How to integrate the GitHub sensor into Home Assistant. description: Instructions on how to integrate the GitHub integration into Home Assistant.
ha_category: ha_category:
- Sensor - Sensor
ha_config_flow: true
ha_release: 0.88 ha_release: 0.88
ha_iot_class: Cloud Polling ha_iot_class: Cloud Polling
ha_domain: github ha_domain: github
@ -13,45 +14,26 @@ ha_codeowners:
- '@ludeeus' - '@ludeeus'
--- ---
The GitHub sensor allows you to monitor your favorite [GitHub](https://github.com/) repositories. Monitored information includes the amount of stargazers, forks, open issues and pull requests, the latest commit message, and more. The GitHub integration allows you to monitor your favorite [GitHub][github] repositories.
## Setup {% include integrations/config_flow.md %}
To set up this sensor you will need a GitHub [personal access token](https://github.com/settings/tokens). You will need to check the `repo` scope for the sensor to function. When you set up this integration, you will first be guided to allow the integration to use the [GitHub API][github_api] on your behalf. If you do not yet have a [GitHub][github] account you will be prompted to create one during the configuration of the integration.
## Configuration When you have authorized the integration, you select repositories you want to monitor, the list contains repositories you have [starred][github_starred] on GitHub with your account.
To enable this platform, add the following to your `configuration.yaml` file: Most of the entities provided by this integration are disabled by default, you can enable these by going to the {% my entities title="entities panel" %}.
```yaml ## Remove authorization
# Example configuration.yaml entry
sensor:
- platform: github
access_token: !secret github_access_token
repositories:
- path: 'home-assistant/core'
```
{% configuration %} After you have removed the integration from {% my integrations title="Configuration -> Devices & Services" %}, you need to manually revoke OAuth app authorization.
access_token:
description: Your GitHub Access Token 1. Go to your [Authorized OAuth Apps][github_apps]
required: true 2. Find the "Home Assistant GitHub Integration" application
type: string 3. Click the 3 dots (`...`) to the right of the name
url: 4. Select "Revoke"
description: If you are using a GitHub Enterprise server, add its URL here. For example, `https://mygithubserver.com`
required: false [github]: https://github.com/
type: string [github_api]: https://docs.github.com/en/rest
repositories: [github_starred]: https://github.com/stars
description: A list of repository paths and optionally a name [github_apps]: https://github.com/settings/applications
required: true
type: list
keys:
path:
description: Path to the repository. For Home Assistant this will be `home-assistant/core`
required: true
type: string
name:
description: Name of the sensor. Gives the sensor a custom name in Home Assistant. Defaults to the repository name from GitHub if not specified.
required: false
type: string
{% endconfiguration %}