diff options
| author | Carlo Sala <carlosalag@protonmail.com> | 2024-05-12 12:40:45 +0200 |
|---|---|---|
| committer | Carlo Sala <carlosalag@protonmail.com> | 2024-05-12 12:40:45 +0200 |
| commit | 0493eab8ce02c4988a16cbe27ad61a20ed8a89df (patch) | |
| tree | db366f243f1d486d9d031a510100bf2655fe15ce | |
| parent | 1d31ff603706007e69aefe2c9ca198658e35b5dc (diff) | |
| download | zsh-0493eab8ce02c4988a16cbe27ad61a20ed8a89df.tar.gz zsh-0493eab8ce02c4988a16cbe27ad61a20ed8a89df.tar.bz2 zsh-0493eab8ce02c4988a16cbe27ad61a20ed8a89df.zip | |
fix(dependencies): check if repo is clean before committing
| -rw-r--r-- | .github/workflows/dependencies/updater.py | 36 |
1 files changed, 21 insertions, 15 deletions
diff --git a/.github/workflows/dependencies/updater.py b/.github/workflows/dependencies/updater.py index 6fa32e378..4533b7aeb 100644 --- a/.github/workflows/dependencies/updater.py +++ b/.github/workflows/dependencies/updater.py @@ -390,21 +390,27 @@ class Git: clean_env["GIT_CONFIG_GLOBAL"] = "/dev/null" clean_env["GIT_CONFIG_NOSYSTEM"] = "1" - # Commit with settings above - CommandRunner.run_or_fail( - [ - "git", - "-c", - f"user.name={user_name}", - "-c", - f"user.email={user_email}", - "commit", - "-m", - f"feat({scope}): update to {version}", - ], - stage="CreateCommit", - env=clean_env, - ) + # check if repo is clean (clean => no error, no commit) + try: + CommandRunner.run_or_fail( + ["git", "diff", "--exit-code"], stage="CheckRepoClean", env=clean_env + ) + except CommandRunner.Exception: + # Commit with settings above + CommandRunner.run_or_fail( + [ + "git", + "-c", + f"user.name={user_name}", + "-c", + f"user.email={user_email}", + "commit", + "-m", + f"feat({scope}): update to {version}", + ], + stage="CreateCommit", + env=clean_env, + ) @staticmethod def push(branch: str): |
