Skipping CI pipelines on Git push
Git push is a common command for transferring commits from a local branch to a remote counterpart. Most of the time it is desirable to run a test or build pipeline in a remote code repository on every change to achieve continuous integration (CI):
Checks are guaranteed to run in a team setting, developers don’t have to remember and do the checks locally.
It’s possible to leverage remote runners to execute expensive and long-running tasks that are not feasible in a local environment.
That being said, if you want to push your code frequently, starting the pipeline with every push might be unnecessary, for example in situations when you know the build will fail. If the pipeline is long, it can also happen that the previous run gets cancelled with a new push (depends on how the pipelines are configured).
The problem here is simple: running the pipelines cost money. While you could define a smaller subset of checks to run on every push, there is an alternative way to reduce the costs. Just skip the CI run if you don’t need it.
The simplest way to skip a pipeline that is recognized by both Github and Gitlab is to add [skip ci]
to the commit message:
git commit -m "work in progress [skip ci]"
git push
Other platforms might support the same or offer an alternative, it is worth checking.
Petr