Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions lib/buildkite/config/build_context.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,22 @@ def nightly?
ENV.has_key?("RAILS_CI_NIGHTLY")
end

def full?
# [ci full], [full ci], [ci-full], or [full-ci]
[ENV["BUILDKITE_MESSAGE"], FetchPr.title].grep(/(ci full|full ci|ci-full|full-ci)/i).any?
end

def skip?
# [ci skip], [skip ci], [ci-skip], or [skip-ci]
[ENV["BUILDKITE_MESSAGE"], FetchPr.title].grep(/(ci skip|skip ci|ci-skip|skip-ci)/i).any?
end

def only_markdown?
`git diff --name-only $BUILDKITE_PULL_REQUEST_BASE_BRANCH`
.lines(chomp: true)
.all? { |line| line.end_with? ".md" }
end

def rails_root
Pathname.pwd
end
Expand Down
2 changes: 1 addition & 1 deletion pipelines/rails-ci/pipeline.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
end
end

if build_context.skip?
if !build_context.full? && (build_context.skip? || build_context.only_markdown?)
command do
label ":bk-status-passed: Build skipped"
skip true
Expand Down