An optional JMESPath filter can be configured when adding Azure Repos integrations.
1. Contains (include)
{value:value[?contains(name, 'example')]}
This is a filter based on the text in the repository name. It lists repositories with the names that contain the word 'example'
. Do note that the declared string format is case-sensitive.
2. Contains (exclude)
{value:value[?(!contains(name, 'Test'))]}
Lists repositories with the names that do not contain the word 'test'
.
!condition
must be wrapped in a parenthesis so it won’t invert the whole expression.
3. Starts with or ends with
{value:value[?(starts_with(name, 'git')||(ends_with(name, 'test')))]}
{value:value[?(starts_with(name, 'git') || (ends_with(name, 'test')))]}
Lists repositories with the names that start with 'git'
or end with 'test'
.
Other examples
{value:value[?contains(project.state, 'wellFormed')]}
{value:value[?contains(project.name, 'test2')]}
{value:value[?contains(project.visibility, 'private')]}
{value:value[?contains(project.visibility, 'public')]}
-
Lists repositories from projects where their state is completely created and ready to use.
-
Lists all repositories from the project named “test2“.
-
Lists all private repositories.
-
Lists all public repositories.
More articles on JMESPath filter examples
GitHub.com | GitHub Enterprise JMESPath filter examples
GitHub App JMESPath filter examples
GitLab.com | GitLab CE/EE JMESPath filter examples
Microsoft | VSTS | TFS | Azure Repos JMESPath filter examples (this page)