From cc0ca72de96568931e36e6f887a3522d210b11a3 Mon Sep 17 00:00:00 2001 From: "sentry[bot]" <39604003+sentry[bot]@users.noreply.github.com> Date: Fri, 25 Sep 2026 14:33:36 +0000 Subject: [PATCH] fix: handle missing git in GitHub Actions CI adapter --- codecov_cli/helpers/ci_adapters/github_actions.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/codecov_cli/helpers/ci_adapters/github_actions.py b/codecov_cli/helpers/ci_adapters/github_actions.py index 14f6c9f62..90b923926 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