Impacted Release Definition Detector

Learn how to detect which release definitions are impacted by code changes for intelligent, targeted validation and deployment workflows

sfops provides two actions for detecting impacted release definitions based on code changes. These enable intelligent workflows that only validate or deploy affected domains, significantly improving CI/CD efficiency in multi-domain Salesforce projects.

Overview

In large Salesforce projects with multiple domains or packages, validating and deploying everything on every change is wasteful. The impacted release definition detectors provide:

  • Change-based detection analyzing git diffs to identify affected packages

  • Dependency awareness including packages that depend on changed code

  • Release config integration working with your existing release definition structure

  • Flexible comparison between commits or branches

This makes them perfect for:

  • Targeted PR validation (only validate changed domains)

  • Efficient deployment pipelines (skip unchanged packages)

  • Cost optimization (reduce scratch org and sandbox usage)

  • Faster feedback loops in large monorepos

Available Actions

sfops provides two variants with different detection strategies:

Action
Strategy
Best For

impactedReleaseDefnDetector

Commit-based comparison

Comparing specific commits (e.g., tag to tag)

impactedReleaseDefnPerChangeDetector

Branch-based comparison

PR validation (feature branch vs main)

How It Works

Both actions use the sfp impact releaseconfig command but with different parameters:

Prerequisites

Before using these actions:

  1. Your workflow uses the sfops Docker image - Required for sfp CLI:

  2. Release definitions exist - Your repository must have release definition files in the expected location (typically releaseconfigs/ or a custom path)

  3. Git history available - The workflow needs access to git history for diff analysis:

Referencing the Actions

Both actions are located in your sfops repository:

Action 1: impactedReleaseDefnDetector

Description

Detects impacted release definitions by comparing two specific commits. Useful for release pipelines or comparing tagged versions.

Usage

Input Reference

Input
Required
Description

pathToReleaseDefns

Yes

Path to directory containing release definitions

from-commit

Yes

Starting commit SHA or reference

to-commit

Yes

Ending commit SHA or reference

filterby

No

Only return if specific release defn is impacted

Action 2: impactedReleaseDefnPerChangeDetector

Description

Detects impacted release definitions by comparing a feature branch against a base branch, with explicit dependency checking. This is the recommended action for PR validation workflows.

Usage

Input Reference

Input
Required
Description

pathToReleaseDefns

Yes

Path to directory containing release definitions

base-branch

Yes

Base branch to compare against (e.g., main)

feature-branch

Yes

Feature branch with changes

Key Features

The impactedReleaseDefnPerChangeDetector includes these additional capabilities via the underlying sfp command:

  • --filterByChangesInBranch: Only considers files actually modified in the branch

  • --explicitDependencyCheck: Includes packages that depend on changed packages

Common Use Cases

Targeted PR Validation

Only validate release definitions affected by PR changes:

Release Pipeline with Change Detection

Only deploy changed domains in a release:

Filtering for Specific Release Definition

Check if a specific release definition is impacted:

Understanding Dependency Detection

The impactedReleaseDefnPerChangeDetector uses --explicitDependencyCheck to include transitive dependencies:

This ensures that changes to foundational packages trigger validation of all dependent packages.

Best Practices

Always Fetch Full Git History

Impact detection requires git history:

Use Branch-Based Detection for PRs

For PR workflows, prefer impactedReleaseDefnPerChangeDetector:

Handle Empty Results

When no release definitions are impacted, handle gracefully:

Troubleshooting

No Impact Detected

If changes aren't being detected:

  1. Verify git history is available (fetch-depth: 0)

  2. Check that changed files map to packages in release definitions

  3. Ensure the path to release definitions is correct

  4. Verify branch names are correct for branch-based detection

Unexpected Packages Included

If more packages are detected than expected:

  1. Review package dependencies in sfdx-project.json

  2. Check if --explicitDependencyCheck is including transitive deps

  3. Verify the base branch is correct

Performance Issues

For repositories with large histories:

  1. Consider using shallow clones with specific depth

  2. Use commit-based detection with recent commits only

  3. Cache git objects between workflow runs

Last updated