Reusable Actions
Reusable GitHub Actions for building custom sfops workflows
Reusable actions are building blocks provided by sfops that you can use to create custom workflows. These composite actions encapsulate common functionality and can be used in any workflow within your sfops repository.
Available Actions
Token & Authentication Actions
- Get GitHub Token - Fetch GitHub tokens from sfp server for repository operations without configuring GitHub Apps
- Hybrid Environment Authentication - Intelligent authentication that automatically uses SFP server or native SFDX authentication based on environment registration
- Hybrid DevHub Authentication - Flexible DevHub authentication with automatic fallback between SFP server and native methods
- Authentication with Lock - Secure authentication with exclusive environment locking for critical operations
- Authentication without Lock - Streamlined authentication for read-only operations and concurrent access
Environment Discovery Actions
- Fetch All Environments - Dynamically fetch and filter environments from GitHub Environments or sfp server for matrix builds and multi-environment workflows
- Match Pool - Match pool assignment rules based on branch and domain patterns for intelligent environment selection
Change Detection Actions
- Impacted Release Definition Detector - Detect which release definitions are impacted by code changes for targeted validation and deployment
PR Interaction Actions
- Add PR Comment - Add, update, and manage PR comments with support for templating, status-based messages, and comment deduplication
Other Actions
sfops includes many other reusable actions for various purposes. You can find them in the /actions directory of your sfops repository:
manageEnvDeploymentLabel- Manage environment deployment labels on PRsfindCurrentPr- Find the current pull request contextget-github-token- Get GitHub App token for authenticationunlockEnvironment- Release environment locksupdateGitRepo- Update dashboard repository with workflow results- And many more...
Using Reusable Actions
All reusable actions in sfops are located in your sfops repository's actions directory. To use them in your custom workflow, reference them using the sfops template variables:
jobs:
your-job:
runs-on: ubuntu-latest
container: ${{ sfops.sfops_docker_image }}
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Use a Reusable Action
uses: ${{ sfops.repo_owner }}/${{ sfops.action_repository }}/[action-name]@main
with:
# Action inputs
input1: value1
input2: value2The ${{ sfops.repo_owner }}/${{ sfops.action_repository }} template variables automatically resolve to your organization and sfops repository (e.g., your-org/sfops-gh-actions).
Creating Custom Workflows
Reusable actions allow you to build sophisticated custom workflows by combining multiple actions. Common use cases include:
- Data operations - Export/import data between environments
- Maintenance automation - Scheduled tasks and cleanup operations
- Multi-environment operations - Parallel operations across environments