Git Integration for Jira Self-Managed (Data Center/Server) Documentation

Contact Support
GitKraken Status  

GitHub App JMESPath filter examples


 

VERSION 4.8+ We have implemented JMESPath filters supporting GitHub Application integrations.

Do note that the declared string format is case-sensitive.

 

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.

JMESPath expressions can have the same format as GitHub integrations connected using a PAT.

 

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.

 

The !condition must 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.com | GitHub Enterprise JMESPath filter examples

GitHub App JMESPath filter examples (this page)

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

Have feedback about this article? Did we miss something? Let us know!
On this page