I'm using circleCI version 2 and my config.yml
like this:
version: 2
jobs:
a:
steps:...
b:
steps:...
workflows:
version: 2
main_pipeline:
jobs:
- a
- b
I want only to build when a change happens in the directory.
job a
for folder a
job b
for folder b
when folder a
changes, build only job a
.
function trigger_job() {
job_name=$1
curl --user ${CIRCLE_API_TOKEN}: \
--data build_parameters[CIRCLE_JOB]=$job_name \
--data revision=$CIRCLE_SHA1 \
https://circleci.com/api/v1.1/project/github/$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME/tree/$CIRCLE_BRANCH
I use this function for trigger job and find different by git-diff like this git diff-tree --name-only $(git log -n 2 --pretty=format:"%H") | grep project