This is an automated email from the ASF dual-hosted git repository.

areusch pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tvm.git


The following commit(s) were added to refs/heads/main by this push:
     new cf831ac  [ci] Fix diff condition for docker builds (#10684)
cf831ac is described below

commit cf831ac820335b961254cd334f32c0c521786dbc
Author: driazati <[email protected]>
AuthorDate: Tue Mar 22 13:18:39 2022 -0700

    [ci] Fix diff condition for docker builds (#10684)
    
    Docker builds weren't triggering on main since it was diffing changes from 
`main` (and there weren't any), so this fixes it so the diff is checked against 
the previous commit for builds on `main`.
    
    cc @areusch
    
    Co-authored-by: driazati <[email protected]>
---
 tests/scripts/git_change_docker.sh | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/tests/scripts/git_change_docker.sh 
b/tests/scripts/git_change_docker.sh
index 465492d..2653275 100755
--- a/tests/scripts/git_change_docker.sh
+++ b/tests/scripts/git_change_docker.sh
@@ -19,7 +19,12 @@
 
 set -eux
 
-changed_files=$(git diff --no-commit-id --name-only -r origin/main)
+BRANCH=$(git rev-parse --abbrev-ref HEAD)
+if [ "$BRANCH" == "main" ]; then
+    changed_files=$(git diff --no-commit-id --name-only -r HEAD~1)
+else
+    changed_files=$(git diff --no-commit-id --name-only -r origin/main)
+fi
 
 for file in $changed_files; do
     echo "Checking $file"

Reply via email to