Setup Salesforce CLI
Version updated for https://github.com/rdbumstead/setup-salesforce-action to version v2.2.0.
- This action is used across all versions by 1 repositories.
Go to the GitHub Marketplace to find the latest changes.
Action Summary
The “Setup Salesforce CLI” GitHub Action provides a fast, secure, and reliable way to set up Salesforce CLI in CI/CD pipelines. It automates tasks like CLI installation, authentication, caching, and plugin management, solving common issues such as slow setup times, fragile authentication, and lack of flexibility in workflows. With features like multi-platform support, extensibility, and smart caching, it is optimized for enterprise-level Salesforce development and deployment.
Release notes
🚀 New Features - Performance & Caching
- OS-Specific Caching - Cache paths are now partitioned by operating system (Linux/macOS/Windows) to prevent cross-platform corruption and improve hit rates
- Optimized Version Resolution - Uses
npm viewto resolve “latest” versions 10x faster than a full install, with 10s timeout protection against network hangs - Smart Hash Detection - Automatically uses
sha256sumorshasum -a 256depending on the runner OS - CLI Health Verification - Automatic health check after CLI installation validates core plugins are loaded and functional
- Detects broken installations immediately instead of failing later in workflows
- Adds ~100ms overhead for significantly improved reliability
- Runs inline with installation step for fast feedback
Performance 🚀
- Setup time: ~25-55s (cached), ~1.5-3 min (first run) on Ubuntu/macOS
- Cache hit rate: >95% across all platforms
- Health check overhead: ~0.1s (negligible)
- Reliability: Broken installations caught immediately
- Platform note: Windows runners are 10-15x slower; Ubuntu recommended for production CI/CD
🛡️ Reliability & Retries
- Resilient Installation Logic - All network-dependent steps now include 3-attempt retries with exponential backoff:
- Salesforce CLI (
@salesforce/cli) sfdx-git-delta@salesforce/plugin-code-analyzer- Custom plugins (each plugin retries individually)
- Salesforce CLI (
- Improved Cache Fallback - When npm registry is unreachable, cache keys now use monthly time-based rotation (
latest-YYYY-MM) instead of static “latest”- Prevents indefinite cache staleness during npm outages
- Automatically rotates monthly to ensure fresh CLI versions
- Provides clearer error messaging about fallback behavior
Added ➕
- Formal Access Token Support - Added explicit support for
auth_method: access-tokenusing thesf org login access-tokencommand (replaces legacy logic) - Access Token Default -
allow_access_token_authnow defaults totrue, making this a safe non-breaking change - New Tests (
test-access-token-auth,test-multiple-plugins) to validate complex scenarios - Enhanced Testing - Added comprehensive CLI health checks to critical and cross-platform test suites
- Health checks now run on all platforms (Ubuntu, macOS, Windows)
- Validates CLI version, core plugins, help system, config commands, and org listing
- Total test coverage increased from ~90% to ~95%
- Workflows: All test workflows now support manual
workflow_dispatchtriggers for on-demand validation.
Changed 🔧
- Test Architecture Overhaul - Replaced monolithic “Quick Tests” (
test.yml) with 4 dedicated workflows (test-critical,test-plugins,test-auth,test-cross-platform) - Improved Plugin Verification - Test suite now uses
jqregex matching to reliably detect namespaced plugins - Better CLI Validation - Switched verification commands to
sf pluginsto ensure core plugin availability - Refactored Retry Tests - Renamed
test-network-retrytotest-cli-install-retryfor clarity - Enhanced Error Messages - Source directory validation now includes actionable troubleshooting tips
- Clarifies that
force-appis auto-created while custom directories must exist - Suggests checking for typos in
source_dirsinput - Reduces support burden with self-service guidance
- Clarifies that
Fixed 🐞
- Windows Permissions - Fixed file permission warnings for temporary auth files (
authurl.txt,access_token.txt) on Windows runners - Instance URL Handling - Auth logic now correctly strips trailing slashes from
instance_urlto prevent connection errors - Custom Plugin Loops - Fixed bash iteration logic to correctly install multiple comma-separated plugins
- Source Flags - Output verification now strictly checks for the
--source-dirformat - Dependencies -
authurl.txtandaccess_token.txtadded to.gitignore - Test Consistency - Standardized boolean input format across all test workflows (
skip_auth: "true"instead of mixedtrue/"true")