This file live in the .circleci/
directory of your project, named config.yml
:
version: 2.1
jobs:
skip:
working_directory: ~/PROJECT_DIRECTORY # If we leave this out, the build will break with missing required arguments
docker: [ image: circleci/ruby:2.6.5 ] # This doesn't really matter, but just choose any docker image
steps: [ checkout ] # A simple step otherwise the build with break with syntax errors
workflows:
version: 2
BRANCH_TO_IGNORE:
jobs:
- skip:
filters:
branches:
ignore: [ BRANCH_TO_IGNORE ]
The reason I used this file with my CircleCI config was so that the CI would run on each branch except master
branch (since that's what GitHub Pages reads from).
By default, unless you have the pull-requests-and-default-branch-only setting turned on, which I don't, CircleCI will still try to run a build on every branch, even if there's no .circleci/config.yml
present in the whole directory. This results in an erring build. So, I've added this .circleci/config.yml
file so there's no error, and then set it to specifically ignore that whole branch. With this set up, CircleCI doesn't even create a build for the branch.