mirror of
https://github.com/f/awesome-chatgpt-prompts.git
synced 2026-03-03 02:47:02 +00:00
chore(scripts): skip commit if no changes detected
This commit is contained in:
@@ -171,6 +171,13 @@ else:
|
||||
|
||||
subprocess.run(['git', 'add', csv_file], check=True)
|
||||
|
||||
# Check if there are actual changes to commit
|
||||
diff_result = subprocess.run(['git', 'diff', '--cached', '--quiet'], capture_output=True)
|
||||
if diff_result.returncode == 0:
|
||||
# No changes staged, skip this commit
|
||||
print(f"[UPDATE {i}/{len(updated_prompts)}] {act} - no changes, skipping")
|
||||
continue
|
||||
|
||||
env = os.environ.copy()
|
||||
env['GIT_AUTHOR_NAME'] = primary_author
|
||||
env['GIT_AUTHOR_EMAIL'] = email
|
||||
@@ -207,6 +214,12 @@ else:
|
||||
# Stage and commit
|
||||
subprocess.run(['git', 'add', csv_file], check=True)
|
||||
|
||||
# Check if there are actual changes to commit
|
||||
diff_result = subprocess.run(['git', 'diff', '--cached', '--quiet'], capture_output=True)
|
||||
if diff_result.returncode == 0:
|
||||
print(f"[NEW {i}/{len(new_prompts)}] {act} - no changes, skipping")
|
||||
continue
|
||||
|
||||
env = os.environ.copy()
|
||||
env['GIT_AUTHOR_NAME'] = primary_author
|
||||
env['GIT_AUTHOR_EMAIL'] = email
|
||||
@@ -249,6 +262,12 @@ else:
|
||||
# Stage and commit
|
||||
subprocess.run(['git', 'add', csv_file], check=True)
|
||||
|
||||
# Check if there are actual changes to commit
|
||||
diff_result = subprocess.run(['git', 'diff', '--cached', '--quiet'], capture_output=True)
|
||||
if diff_result.returncode == 0:
|
||||
print(f"[REMOVE {i}/{len(deleted_prompts)}] {act} - no changes, skipping")
|
||||
continue
|
||||
|
||||
env = os.environ.copy()
|
||||
env['GIT_AUTHOR_NAME'] = primary_author
|
||||
env['GIT_AUTHOR_EMAIL'] = email
|
||||
|
||||
Reference in New Issue
Block a user