This filter will allow users to connect only those repositories from a GitHub App integration that matches the JMESPath expression.
GitHub applications have two type of scopes:
Selected repositories – this type works in the same way JMESPath filter is used in standard GitHub integrations:
- the user selects the particular repositories and after that, this set of connected repositories is not changed during reindex of the integration.
All repositories – this type works in another way, where, the set of repositories is changing dynamically as the scope includes all repositories:
when new repositories appear in the organization, they are added to the scope.
when some repositories are deleted from the organization, they are removed from the scope.
So if the user selects the All repositories scope, it would be more convenient to select repositories using JMESPath. This is in order for the new repositories appearing in the organization to be filtered by JMESPath automatically.
GitHub Apps have different JMESPath format in comparison with previous GitHub integrations:
it must start with
repositories ||and then,
it should be followed by any valid JMESPath from standard GitHub integration.
1. Starts with
repositories || [?starts_with(name, 'repo-prefix')]
This is a filter based on the text in the repository name. It lists repositories with the names that start with the specified word. Do note that the declared string format is case-sensitive.
2. Contains (include)
repositories || [?contains(name, 'substring')]
Lists repositories with the names that contain the specified word.
3. Contains (exclude)
repositories || [?(!contains(name, 'search-phrase'))]
Lists repositories with the names that do not contain the specified word.
!conditionmust be wrapped in a parenthesis so it won’t invert the whole expression.
4. Specific (exact)
repositories || [?name == 'exact-repo-name']
Lists repositories with the exact specified name.
More articles on JMESPath filter examples
GitHub App JMESPath filter examples (this page)