diff --git a/codecov_cli/helpers/ci_adapters/github_actions.py b/codecov_cli/helpers/ci_adapters/github_actions.py index 14f6c9f6..90b92392 100644 --- a/codecov_cli/helpers/ci_adapters/github_actions.py +++ b/codecov_cli/helpers/ci_adapters/github_actions.py @@ -18,12 +18,15 @@ def _get_commit_sha(self): return commit # actions/checkout should be run with fetch-depth > 1 or set to 0 for this to work - completed_subprocess = subprocess.run( - ["git", "rev-parse", "HEAD^@"], capture_output=True - ) - parents_hash = completed_subprocess.stdout.decode().strip().splitlines() - if len(parents_hash) == 2: - return parents_hash[1] + try: + completed_subprocess = subprocess.run( + ["git", "rev-parse", "HEAD^@"], capture_output=True + ) + parents_hash = completed_subprocess.stdout.decode().strip().splitlines() + if len(parents_hash) == 2: + return parents_hash[1] + except OSError: + pass # git not available in PATH; fall back to GITHUB_SHA return commit