Documentation (2024.2 Enterprise)

# Restricting hook execution

(missing or bad snippet)

TeamHub executes all active webhooks by default. You can restrict the execution of repository hooks by using case-insensitive regular expressions on reference and path. When set, the hook executes only if the reference pattern matches a branch or a bookmark, and/or if any of the changed paths matches the path pattern.

For examples, to execute a hook only:

- When `main` or `develop` branches are updated:

  Set reference pattern as `^(main|develop)$` and leave path pattern empty.

- When javascript files are changed:

  Leave reference pattern empty and set path pattern as `.*\.js$`.

- On feature branches changing paths matching `tests`:

  Set reference pattern as `^feature` and path pattern as `tests`.

Your search for returned results

Your search for returned results