Skip to main content
Similar to the Source Control Management (SCM) integration plugin, the GitHub integration plugin for Soundcheck provides out-of-box integration with GitHub by leveraging Backstage’s GitHub integration to implement collection of facts from GitHub repositories. The purpose of the GitHub integration plugin is to provide GitHub-specific fact collection (like branch protections), while the SCM integration plugin provides the collection of facts based on repository content. The GitHub integration allows collecting details about repositories and branches, as well as security alerts and advisories that come as part of the GitHub Advanced Security products. The collection of the following facts is supported:

Prerequisites

Configure GitHub integration in Backstage

Integrations are configured at the root level of app-config.yaml. Here’s an example configuration for GitHub:
Consult the Backstage GitHub integration instructions for full configuration details.
If no GitHub integration is configured for a repository, the GitHub Fact Collector will not make unauthenticated requests and will instead return a fact collection error. This avoids hitting low unauthenticated rate limits that could block the entire GitHub Fact Collector queue.

Add the GitHubFactCollector to Soundcheck

GitHub integration for Soundcheck is not installed by default. It must be manually installed and configured for the GitHub Fact Collector to work. First, add the @spotify/backstage-plugin-soundcheck-backend-module-github package:
Then add the following to your packages/backend/src/index.ts file:
packages/backend/src/index.ts
Consult the Soundcheck Backend documentation for additional details on setting up the Soundcheck backend.

Entity configuration

To be able to determine the repository to use the GitHub integration will use the value from the backstage.io/source-location annotation. In many cases this will be set for you but if it is not you will need to add it to your catalog-info.yaml file, here’s a simple example:

Plugin Configuration

The collection of facts is driven by configuration. To learn more about the configuration, jump to the Defining GitHub Fact Collectors section. GitHub Fact Collector can be configured via YAML or No-Code UI. If you configure it via both YAML and No-Code UI, the configurations will be merged. It’s preferable to choose a single source for the Fact Collectors configuration (either No-Code UI or YAML) to avoid confusing merge results.

No-Code UI Configuration Option

  1. Make sure the prerequisite Configure GitHub integration in Backstage is completed and GitHub instance details are configured.
  2. To enable the GitHub Integration, go to Soundcheck > Integrations > GitHub and click the Configure button. To learn more about the No-Code UI config, see the Configuring a fact collector (integration) via the no-code UI.
GitHub
Integration

YAML Configuration Option

  1. Create a github-facts-collectors.yaml file in the root of your Backstage repository and fill in all your GitHub Fact Collectors. A simple example GitHub Fact Collector is listed below.
    Note: this file will be loaded at runtime along with the rest of your Backstage configuration files. Therefore, make sure that it’s available in deployed environments in the same way as your app-config.yaml files are.
  2. Add a soundcheck collectors field to app-config.yaml and reference the newly created github-facts-collectors.yaml

Rate Limiting (Optional)

This fact collector can be rate limited in Soundcheck using the following configuration:
GitHub API has a limit of 5000 requests per hour (15000 for Enterprise). We recommend setting your rate limit to something below this, i.e. in the example above, we set the rate limit to 4900 executions every hour. This fact collector handles rate limit errors per the recommendation from GitHub. Soundcheck will automatically wait and retry requests that are rate limited.

Defining GitHub Fact Collectors

This section describes the data shape and semantics of GitHub Fact Collectors.

Overall Shape Of A GitHub Fact Collector

The following is an example of a descriptor file for a GitHub Fact Collector:
Below are the details for each field.

frequency [optional]

The frequency at which the collector should be executed. Possible values are either a cron expression { cron: ... } or HumanDuration. This is the default frequency for each collector.

initialDelay [optional]

The amount of time that should pass before the first invocation happens. Possible values are either a cron expression { cron: ... } or HumanDuration.

batchSize [optional]

The number of entities to collect facts for at once. Optional, the default value is 1. Note: Fact collection for a batch of entities is still considered as one hit towards the rate limits by the Soundcheck Rate Limiting engine, while the actual number of hits will be equal to the batchSize. Example:

filter [optional]

A filter specifying which entities to collect the specified facts for. Matches the filter format used by the Catalog API. This is the default filter for each collector. See filters for more details.

exclude [optional]

Entities matching this filter will be skipped during the fact collection process. Can be used in combination with filter. Matches the filter format used by the Catalog API.

cache [optional]

If the collected facts should be cached, and if so for how long. Possible values are either true or false or a nested { duration: HumanDuration } field. This is the default cache config for each collector.

collects [required]

An array describing which facts to collect and how to collect them. See below for details about the overall shape of a fact collector.

Overall Shape Of A Fact Collector

Each collector supports the fields described below.

factName [required]

The name of the fact to be collected.
  • Minimum length of 1
  • Maximum length of 100
  • Alphanumeric with single separator instances of periods, dashes, underscores, or forward slashes

type [required]

The type of the collector (e.g. BranchProtections, RepositoryDetails).

frequency [optional]

The frequency at which the fact collection should be executed. Possible values are either a cron expression { cron: ... } or HumanDuration. If provided, it overrides the default frequency provided at the top level. If not provided, it defaults to the frequency provided at the top level. If neither collector’s frequency, nor default frequency is provided, the fact will only be collected on demand. Example:

batchSize [optional]

The number of entities to collect facts for at once. Optional, the default value is 1. If provided it overrides the default batchSize provided at the top level. If not provided it defaults to the batchSize provided at the top level. If neither collector’s batchSize nor default batchSize is provided the fact will be collected for one entity at a time. Note: Fact collection for a batch of entities is still considered as one hit towards the rate limits by the Soundcheck Rate Limiting engine, while the actual number of hits will be equal to the batchSize. Example:

filter [optional]

A filter specifying which entities to collect the specified facts for. Matches the filter format used by the Catalog API. If provided, it overrides the default filter provided at the top level. If not provided, it defaults to the filter provided at the top level. If neither collector’s filter, nor default filter is provided, the fact will be collected for all entities.

exclude [optional]

Entities matching this filter will be skipped during the fact collection process. Can be used in combination with filter. Matches the filter format used by the Catalog API.

cache [optional]

If the collected facts should be cached, and if so for how long. Possible values are either true or false or a nested { duration: HumanDuration } field. If provided, it overrides the default cache config provided at the top level. If not provided, it defaults to the cache config provided at the top level. If neither collector’s cache nor default cache config is provided, the fact will not be cached. Example:

Collecting BranchProtections Fact

The BranchProtections fact contains information about configured branch protections for a default branch in a GitHub repository. Prerequisites:
  • Grant your GitHub app or access token with necessary permissions listed in the Get branch protection GitHub API documentation.

Shape of A BranchProtections Fact Collector

The shape of a BranchProtections Fact Collector matches the Overall Shape Of A Fact Collector (restriction: type: BranchProtections). The following is an example of the BranchProtections Fact Collector configuration:

Shape of A BranchProtections Fact

The shape of a BranchProtections Fact is based on the Fact Schema. For a description of the data collected regarding branch protection, refer to the GitHub API documentation. The following is an example of the collected BranchProtections fact:

Shape of A BranchProtections Fact Check

The shape of a BranchProtections Fact Check matches the Shape of a Fact Check. The following is an example of the BranchProtections fact checks:
The following is an example of the Soundcheck track that utilizes these checks:

Collecting BranchRules Fact

The BranchRules fact contains information about configured branch rules for a default branch in a GitHub repository. Prerequisites:
  • Grant your GitHub app or access token with necessary permissions listed in the Get rules for a branch GitHub API documentation.

Shape of A BranchRules Fact Collector

The shape of a BranchRules Fact Collector matches the Overall Shape Of A Fact Collector (restriction: type: BranchRules). The following is an example of the BranchRules Fact Collector configuration:

Shape of A BranchRules Fact

The shape of a BranchRules Fact is based on the Fact Schema. For a description of the data collected regarding branch rules, refer to the GitHub API documentation. The following is an example of the collected BranchRules fact:

Shape of A BranchRules Fact Check

The shape of a BranchRules Fact Check matches the Shape of a Fact Check. The following is an example of the BranchRules fact checks:
The following is an example of the Soundcheck track that utilizes these checks:

Collecting CodeScanningAlerts Fact

The CodeScanningAlerts fact contains information about code scanning alerts for a default branch in a GitHub repository. Prerequisites:
  1. In order to be able to collect code scanning alerts you must enable them in GitHub, refer to the GitHub Code Scanning documentation.
  2. Grant your GitHub app or access token with necessary permissions listed in the List code scanning alerts for a repository GitHub API documentation.
This is a sensitive fact. See docs for more details.

Shape of A CodeScanningAlerts Fact Collector

The shape of a CodeScanningAlerts Fact Collector matches the Overall Shape Of A Fact Collector (restriction: type: CodeScanningAlerts) and supports additional configuration options:

toolName [optional]

The name of a code scanning tool. If specified, only results by this tool will be collected. Example: ‘CodeQL’.

state [optional]

If specified, only code scanning alerts with this state will be returned. Can be one of: ‘open’, ‘closed’, ‘dismissed’, ‘fixed’.

severity [optional]

If specified, only code scanning alerts with this severity will be returned. Can be one of: ‘critical’, ‘high’, ‘medium’, ‘low’, ‘warning’, ‘note’, ‘error’. The following is an example of the CodeScanningAlerts Fact Collector configuration:

Shape of A CodeScanningAlerts Fact

The shape of a CodeScanningAlerts Fact is based on the Fact Schema. For a description of the data collected regarding code scanning alerts, refer to the GitHub API documentation. The following is an example of the collected CodeScanningAlerts fact:

Shape of A CodeScanningAlerts Fact Check

The shape of a CodeScanningAlerts Fact Check matches the Shape of a Fact Check. The following is an example of the CodeScanningAlerts fact checks:
The following is an example of the Soundcheck track that utilizes these checks:

Collecting DependabotAlerts Fact

The DependabotAlerts fact contains information about dependabot alerts for a GitHub repository. Prerequisites:
  1. In order to be able to collect dependabot alerts you must enable them in GitHub, refer to the GitHub Dependabot documentation.
  2. Grant your GitHub app or access token with necessary permissions listed in the List Dependabot alerts for a repository GitHub API documentation.
This is a sensitive fact. See docsfor more details.

Shape of A DependabotAlerts Fact Collector

The shape of a DependabotAlerts Fact Collector matches the Overall Shape Of A Fact Collector (restriction: type: DependabotAlerts) and supports additional configuration options:

states [optional]

If specified, only dependabot alerts with these states will be returned. Possible values: ‘auto_dismissed’, ‘dismissed’, ‘fixed’, ‘open’.

severities [optional]

If specified, only dependabot alerts with these severities will be returned. Possible values: ‘low’, ‘medium’, ‘high’, ‘critical’. The following is an example of the DependabotAlerts Fact Collector configuration:

Shape of A DependabotAlerts Fact

The shape of a DependabotAlerts Fact is based on the Fact Schema. For a description of the data collected regarding dependabot alerts, refer to the GitHub API documentation. The following is an example of the collected DependabotAlerts fact:

Shape of A DependabotAlerts Fact Check

The shape of a DependabotAlerts Fact Check matches the Shape of a Fact Check. The following is an example of the DependabotAlerts fact checks:
The following is an example of the Soundcheck track that utilizes these checks:

Collecting RepositoryDetails Fact

The RepositoryDetails fact contains information about a GitHub repository. Prerequisites:
  • Grant your GitHub app or access token with necessary permissions listed in the Get a repository GitHub API documentation.

Shape of A RepositoryDetails Fact Collector

The shape of a RepositoryDetails Fact Collector matches the Overall Shape Of A Fact Collector (restriction: type: RepositoryDetails). The following is an example of the RepositoryDetails Fact Collector configuration:

Shape of A RepositoryDetails Fact

The shape of a RepositoryDetails Fact is based on the Fact Schema. For a description of the data collected about repository, refer to the GitHub API documentation. The following is an example of the collected RepositoryDetails fact:

Shape of A RepositoryDetails Fact Check

The shape of a RepositoryDetails Fact Check matches the Shape of a Fact Check. The following is an example of the RepositoryDetails fact checks:
The following is an example of the Soundcheck track that utilizes these checks:

Collecting RepositoryLanguages Fact

The RepositoryLanguages fact contains information about languages used in a GitHub repository. Prerequisites:
  • Grant your GitHub app or access token with necessary permissions listed in the List repository languages GitHub API documentation.

Shape of A RepositoryLanguages Fact Collector

The shape of a RepositoryLanguages Fact Collector matches the Overall Shape Of A Fact Collector (restriction: type: RepositoryLanguages). The following is an example of the RepositoryLanguages Fact Collector configuration:

Shape of A RepositoryLanguages Fact

The shape of a RepositoryLanguages Fact is based on the Fact Schema. For a description of the data collected about repository languages, refer to the GitHub API documentation. The following is an example of the collected RepositoryLanguages fact:

Shape of A RepositoryLanguages Fact Check

The shape of a RepositoryLanguages Fact Check matches the Shape of a Fact Check. The following is an example of the RepositoryLanguages fact checks:
The following is an example of the Soundcheck track that utilizes these checks:

Collecting SecretScanningAlerts Fact

The SecretScanningAlerts fact contains information about secret scanning alerts for a GitHub repository. Prerequisites:
  1. In order to be able to collect secret scanning alerts you must enable them in GitHub, refer to the GitHub Secret Scanning documentation.
  2. Grant your GitHub app or access token with necessary permissions listed in the List secret scanning alerts for a repository GitHub API documentation.
This is a sensitive fact. See docsfor more details.

Shape of A SecretScanningAlerts Fact Collector

The shape of a CodeScanningAlerts Fact Collector matches the Overall Shape Of A Fact Collector (restriction: type: SecretScanningAlerts) and supports additional configuration options:

state [optional]

If specified, only secret scanning alerts with this state will be returned. Can be one of: ‘open’, ‘resolved’.

validities [optional]

If specified, only code scanning alerts with these validities will be returned. Possible values: ‘active’, ‘inactive’, ‘unknown’. The following is an example of the SecretScanningAlerts Fact Collector configuration:

Shape of A SecretScanningAlerts Fact

The shape of a SecretScanningAlerts Fact is based on the Fact Schema. For a description of the data collected regarding secret scanning alerts, refer to the GitHub API documentation. The following is an example of the collected SecretScanningAlerts fact:

Shape of A SecretScanningAlerts Fact Check

The shape of a SecretScanningAlerts Fact Check matches the Shape of a Fact Check. The following is an example of the SecretScanningAlerts fact checks:
The following is an example of the Soundcheck track that utilizes these checks:

Collecting SecurityAdvisories Fact

The SecurityAdvisories fact contains information about security advisories in a GitHub repository. Prerequisites:

Shape of A SecurityAdvisories Fact Collector

The shape of a SecurityAdvisories Fact Collector matches the Overall Shape Of A Fact Collector (restriction: type: SecurityAdvisories) and supports additional configuration options:

state [optional]

If specified, only security advisories with this state will be returned. Can be one of: ‘triage’, ‘draft’, ‘published’, ‘closed’. The following is an example of the SecurityAdvisories Fact Collector configuration:

Shape of A SecurityAdvisories Fact

The shape of a SecurityAdvisories Fact is based on the Fact Schema. For a description of the data collected regarding security advisories, refer to the GitHub API documentation. The following is an example of the collected SecurityAdvisories fact:

Shape of A SecurityAdvisories Fact Check

The shape of a SecurityAdvisories Fact Check matches the Shape of a Fact Check. The following is an example of the SecurityAdvisories fact checks:
The following is an example of the Soundcheck track that utilizes these checks:

Appendix

Pre-built Recommended GitHub Settings checks are based on the following collector configuration: