Don't run Buildkite CI on .github config changes (#25271)

This commit is contained in:
Felix Becker 2021-09-23 09:47:08 +02:00 committed by GitHub
parent 5b2780e5d4
commit 58f7e1f95f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 0 deletions

View File

@ -17,6 +17,16 @@ func (c ChangedFiles) onlyDocs() bool {
return true
}
// onlyConfig returns whether the ChangedFiles are only config file changes that don't need to run CI.
func (c ChangedFiles) onlyConfig() bool {
for _, p := range c {
if !strings.HasPrefix(p, ".github/") {
return false
}
}
return true
}
// onlySg returns whether the ChangedFiles are only in the ./dev/sg folder.
func (c ChangedFiles) onlySg() bool {
for _, p := range c {

View File

@ -45,6 +45,10 @@ func CoreTestOperations(changedFiles ChangedFiles, buildOptions bk.BuildOptions)
// Build special pipelines for changes that only touch a subset of code.
switch {
case changedFiles.onlyConfig():
// If this PR only affects e.g. .github config files, no steps are necessary to run.
operations = []Operation{}
case changedFiles.onlyDocs():
// If this is a docs-only PR, run only the steps necessary to verify the docs.
operations = []Operation{