[CI] Fix check_for_changed_files from committing to main (#189316)

## Summary

This `if` statement is failing in the on-merge pipeline where
`BUILDKITE_PULL_REQUEST="false"` (See `Environment` tab in
https://buildkite.com/elastic/kibana-on-merge/builds/48189#0190efb6-fae2-415a-85dc-1508717e6e5c).
This cause the function to try to commit changes to a non-existent PR
and fail (see logs in same linked build).
This commit is contained in:
Brad White 2024-07-31 10:24:12 -06:00 committed by GitHub
parent 5a9913ebdb
commit 3d352549e3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -36,7 +36,7 @@ check_for_changed_files() {
GIT_CHANGES="$(git status --porcelain -- . ':!:.bazelrc' ':!:config/node.options' ':!config/kibana.yml')"
if [ "$GIT_CHANGES" ]; then
if ! is_auto_commit_disabled && [[ "$SHOULD_AUTO_COMMIT_CHANGES" == "true" && "${BUILDKITE_PULL_REQUEST:-}" ]]; then
if ! is_auto_commit_disabled && [[ "$SHOULD_AUTO_COMMIT_CHANGES" == "true" && "${BUILDKITE_PULL_REQUEST:-}" != "" && "${BUILDKITE_PULL_REQUEST}" != "false" ]]; then
NEW_COMMIT_MESSAGE="[CI] Auto-commit changed files from '$1'"
PREVIOUS_COMMIT_MESSAGE="$(git log -1 --pretty=%B)"