I was able to ignore directory, file changes using the following syntax.
build:
script: npm run build
except:
changes:
- "*.md"
- "src/**/*.ts"
With this configuration build job is going to run except git changes include only *.md extension file or *.ts files in src directory. They're ignored.
But then they deprecated this only:changes, except:changes syntax and warned to use rules syntax instead. Unfortunately, I cannot seem to find how to ignore directory, file changes using this new syntax.