This filter will allow users to connect only those repositories from the 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.
Examples of JMESPath expressions for GitHub App
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')]
Lists repositories with names that starts with the specified word.
2. Contains (include)
repositories[] | [?contains(name, 'substring')]
Lists repositories with names that contains the specified word.
3. Contains (exclude)
repositories[] | [?!contains(name, '<search_phrase>')]
Lists repositories with names that does not contain the specified word.
4. Specific (exact)
repositories[] | [?name == 'exact-repo-name')]
This is a filter based on the text in the repository name. It will list repositories with names that contain the specified word. Do note that the declared string format is case-sensitive.
More articles on JMESPath filter examples
GitHub.com | GitHub Enterprise JMESPath filter examples
GitLab.com | GitLab CE/EE JMESPath filter examples
Microsoft | VSTS | TFS | Azure Repos JMESPath filter examples
Tracked Folders JMESPath filter examples
Gerrit JMESPath filter examples
GitHub App JMESPath filter examples (this page)