How actions/checkout works
Checkout is a GitHub Action that reads workflow inputs, validates checkout settings, obtains repository content, and places the requested revision in the workspace. Its main source-provider orchestrates repository preparation, Git fetch/checkout, and API archive fallback; credentials and post-job cleanup are separate concerns. The README documents sparse checkout, partial clone, LFS, submodules, and credential persistence. Some feature implementations were not excerpted, so links rely on the source index or README where supported.
Main entry points: git-source-provider.ts Source orchestration · git-command-manager.ts Git command manager · main.ts Action lifecycle · input-helper.ts Input parsing
Components 18
Action entry
- Action lifecycle
src/main.ts - Input parsing
src/input-helper.ts - Checkout settings
src/git-source-settings.ts
Checkout workflow
- Source orchestration
src/git-source-provider.ts - Workspace preparation
src/git-directory-helper.ts - Archive and repository API
src/github-api-helper.ts
Git operations
- Ref resolution
src/ref-helper.ts - Git command manager
src/git-command-manager.ts - Git version
src/git-version.ts - Repository URLs
src/url-helper.ts - Filesystem helpers
src/fs-helper.ts - Retry handling
src/retry-helper.ts
Credentials and safety
- Git authentication
src/git-auth-helper.ts - Unsafe PR guard
src/unsafe-pr-checkout-helper.ts - Workflow context
src/workflow-context-helper.ts - Post-job state
src/state-helper.ts
Other components
- Workflow runner
- GitHub repository
Connections 28
- Workflow runner → Action lifecycle: invokes
README.md - Action lifecycle → Input parsing: reads inputs
src/main.ts - Input parsing → Checkout settings: builds settings
src/input-helper.ts - Input parsing → Unsafe PR guard: checks checkout
src/input-helper.ts - Input parsing → Workflow context: reads context
src/input-helper.ts - Action lifecycle → Source orchestration: requests checkout
src/main.ts - Action lifecycle → Post-job state: checks post state
src/main.ts - Source orchestration → Checkout settings: uses settings
src/git-source-provider.ts - Source orchestration → Workspace preparation: prepares workspace
src/git-source-provider.ts - Source orchestration → Git command manager: runs Git operations
src/git-source-provider.ts - Source orchestration → Git authentication: configures credentials
src/git-source-provider.ts - Source orchestration → Archive and repository API: requests API fallback
src/git-source-provider.ts - Source orchestration → Ref resolution: resolves refs
src/git-source-provider.ts - Source orchestration → Filesystem helpers: checks workspace
src/git-source-provider.ts - Source orchestration → Post-job state: saves cleanup state
src/git-source-provider.ts - Archive and repository API → GitHub repository: requests repository data
src/github-api-helper.ts - Archive and repository API → Retry handling: retries downloads
src/github-api-helper.ts - Archive and repository API → Repository URLs: resolves API URL
src/github-api-helper.ts - Git command manager → Git version: detects version
src/git-command-manager.ts - Git command manager → Ref resolution: uses ref helpers
src/git-command-manager.ts - Git command manager → Filesystem helpers: uses filesystem helpers
src/git-command-manager.ts - Git authentication → Git command manager: configures Git
src/git-auth-helper.ts - Git authentication → Post-job state: saves credential paths
src/git-auth-helper.ts - Workspace preparation → Git command manager: prepares existing repo
src/git-directory-helper.ts - Action lifecycle → Source orchestration: cleans up post-job
src/main.ts - Source orchestration → Git command manager: fetches and checks out
README.md - Source orchestration → GitHub repository: downloads repository
- Git command manager → Retry handling: retries Git commands
src/git-command-manager.ts