Angelica Rosa
Angelica Rosa

Reputation: 1246

How to avoid automatic pipelines to start on a particular commit?

I've setup a Bitbucket Pipeline with automatic start on branch "release".

The pipeline runs a script that builds the app and increments the app version, and then commits and pushes the changes to git.

But in this way, just after the first execution finish, the pipeline starts again because of the commit.

There's any way to exclude only the script commit from the pipeline triggers?

Upvotes: 1

Views: 2359

Answers (1)

jessehouwing
jessehouwing

Reputation: 114731

If you include [skip ci] in your commit message, the pipeline shouldn't trigger.

A Pull-Request validation will still trigger (if nothing has changed), you can manually extend your pipeline to check the commit message and abort the pipeline early or simply skip the push.

- step
    script:
      -  if [[ ! $(git log -1 --pretty=%B) =~ (\[ci skip\])|(\[skip ci\]) ]]; then git push; fi

Upvotes: 3

Related Questions