Add configurable timeout and retry for git network operations

Add per-attempt timeout (default 300s) and Kubernetes probe-style retry
configuration for git fetch, lfs-fetch, and ls-remote. New action inputs:
timeout, retry-max-attempts, retry-min-backoff, retry-max-backoff.

Fixes https://github.com/actions/checkout/issues/631

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Anatoly Rabkin 2026-03-18 18:06:25 +02:00
parent 0c366fd6a8
commit 5df58a66d1
10 changed files with 342 additions and 81 deletions

View file

@ -95,6 +95,29 @@ inputs:
set-safe-directory:
description: Add repository path as safe.directory for Git global config by running `git config --global --add safe.directory <path>`
default: true
timeout:
description: >
Timeout in seconds for each git network operation attempt (fetch, lfs-fetch, ls-remote).
If a single attempt exceeds this, it is killed and retried.
Set to 0 to disable. Default is 300 (5 minutes).
Similar to Kubernetes probe timeoutSeconds.
default: 300
retry-max-attempts:
description: >
Maximum number of retry attempts for failed git network operations.
Similar to Kubernetes probe failureThreshold.
default: 3
retry-min-backoff:
description: >
Minimum backoff time in seconds between retry attempts.
The actual backoff is randomly chosen between min and max.
Similar to Kubernetes probe periodSeconds.
default: 10
retry-max-backoff:
description: >
Maximum backoff time in seconds between retry attempts.
The actual backoff is randomly chosen between min and max.
default: 20
github-server-url:
description: The base URL for the GitHub instance that you are trying to clone from, will use environment defaults to fetch from the same instance that the workflow is running from unless specified. Example URLs are https://github.com or https://my-ghes-server.example.com
required: false