Pipeline on branch

Hi,
how to prevent pipeline from working when i create a new branch?

i tried:
expect:
- new-branch

but it didn’t work,any help please?

Thanks

rules:   
  - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH

This will trigger the pipeline if changes are merged to the default branch, it will exclude the pipeline from running when you create a new branch.

Hi, thanks

if yaml file is changed also??

The only way the stage/job will run when governed by that rule is if the changes are merged into the default branch. What exactly are you trying to accomplish?

If it’s just a one off change that you don’t need the pipeline to run, I sometimes need to modify the .gitlab-ci.yml file without kicking off a pipeline. I will edit the file on the default branch, then I will push the changes with git push --push-option=ci.skip This will push the changes up but keep the pipeline from running.

this rule should be at job level ? any option to make the same thing at yaml file or stages level?
thnaks

You can have rules at the top-level of the YAML file, if you wish, using the workflow keyword.

If I want execute pipeline when I create branch (release/x.y.z) from branch develop ?
How-to know in a gitlab-ci.yml if I create branch ?