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

tison pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/pulsar-site.git

commit 22d9f52fb7f7f2c99cfd358b11dc39e03895b5e3
Author: tison <[email protected]>
AuthorDate: Wed Jan 11 18:54:04 2023 +0800

    [improve][pytools] Lightweight diff checker
    
    Signed-off-by: tison <[email protected]>
---
 tools/pytools/lib/execute/site_uploader.py | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/tools/pytools/lib/execute/site_uploader.py 
b/tools/pytools/lib/execute/site_uploader.py
index 3317effceb4..2e747195e30 100755
--- a/tools/pytools/lib/execute/site_uploader.py
+++ b/tools/pytools/lib/execute/site_uploader.py
@@ -47,6 +47,9 @@ def _do_push(msg: str, site: Path, branch: str):
     git = find_command('git', msg="git is required")
 
     run(git, 'add', '-A', '.', cwd=site)
+    changed = run(git, 'diff-index', '--quiet', 'HEAD').returncode
+    print(f'changed: {changed}')
+
     run(git, 'status', cwd=site)
     run(git, 'remote', '-v', cwd=site)
     if os.getenv('GITHUB_ACTIONS') is not None:
@@ -56,10 +59,10 @@ def _do_push(msg: str, site: Path, branch: str):
         else:
             name = 'github-actions[bot]'
             email = f'41898282+{name}@users.noreply.github.com'
+        print(f'config with name: {name}, email: {email}')
         run(git, 'config', 'user.name', name, cwd=site)
         run(git, 'config', 'user.email', email, cwd=site)
-    changed = run_pipe(git, 'status', '--porcelain', cwd=site).read().strip()
-    if len(changed) != 0:
+    if changed != 0:
         run(git, 'commit', '-m', msg, cwd=site)
         run(git, 'push', 'origin', branch, cwd=site)
 

Reply via email to