salesforce-ci-integration
Configure Salesforce CI/CD with GitHub Actions, SFDX deployments, and Apex testing. Use when setting up automated testing, configuring CI pipelines for metadata deployment, or integrating Salesforce tests into your build process. Trigger with phrases like "salesforce CI", "salesforce GitHub Actions", "salesforce automated tests", "CI salesforce", "sfdx deploy CI".
Best use case
salesforce-ci-integration is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
Configure Salesforce CI/CD with GitHub Actions, SFDX deployments, and Apex testing. Use when setting up automated testing, configuring CI pipelines for metadata deployment, or integrating Salesforce tests into your build process. Trigger with phrases like "salesforce CI", "salesforce GitHub Actions", "salesforce automated tests", "CI salesforce", "sfdx deploy CI".
Teams using salesforce-ci-integration should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/salesforce-ci-integration/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How salesforce-ci-integration Compares
| Feature / Agent | salesforce-ci-integration | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
Configure Salesforce CI/CD with GitHub Actions, SFDX deployments, and Apex testing. Use when setting up automated testing, configuring CI pipelines for metadata deployment, or integrating Salesforce tests into your build process. Trigger with phrases like "salesforce CI", "salesforce GitHub Actions", "salesforce automated tests", "CI salesforce", "sfdx deploy CI".
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
Related Guides
AI Agents for Coding
Browse AI agent skills for coding, debugging, testing, refactoring, code review, and developer workflows across Claude, Cursor, and Codex.
AI Agents for Marketing
Discover AI agents for marketing workflows, from SEO and content production to campaign research, outreach, and analytics.
Best AI Agents for Marketing
A curated list of the best AI agents and skills for marketing teams focused on SEO, content systems, outreach, and campaign execution.
SKILL.md Source
# Salesforce CI Integration
## Overview
Set up CI/CD pipelines for Salesforce using GitHub Actions with JWT-based authentication, automated Apex testing, and metadata deployment.
## Prerequisites
- GitHub repository with Actions enabled
- Salesforce Connected App with JWT Bearer flow configured
- RSA key pair (private key stored as GitHub Secret)
- Scratch org or sandbox for test execution
## Instructions
### Step 1: Create GitHub Actions Workflow
Create `.github/workflows/salesforce-ci.yml`:
```yaml
name: Salesforce CI
on:
push:
branches: [main, develop]
pull_request:
branches: [main]
jobs:
validate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
- name: Install Salesforce CLI
run: npm install -g @salesforce/cli
- name: Authenticate to Salesforce (JWT)
run: |
echo "${{ secrets.SF_JWT_KEY }}" > server.key
sf org login jwt \
--client-id ${{ secrets.SF_CLIENT_ID }} \
--jwt-key-file server.key \
--username ${{ secrets.SF_USERNAME }} \
--set-default \
--alias ci-org
rm server.key
- name: Validate Metadata Deployment (dry run)
run: |
sf project deploy start \
--target-org ci-org \
--dry-run \
--wait 30
- name: Run Apex Tests
run: |
sf apex run test \
--target-org ci-org \
--result-format human \
--code-coverage \
--wait 20
- name: Check API Limits
run: |
sf limits api display --target-org ci-org --json | \
jq '.result[] | select(.name == "DailyApiRequests") | "\(.name): \(.remaining)/\(.max)"'
integration-tests:
runs-on: ubuntu-latest
needs: validate
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
- run: npm ci
- name: Run jsforce Integration Tests
env:
SF_LOGIN_URL: https://test.salesforce.com
SF_USERNAME: ${{ secrets.SF_USERNAME }}
SF_PASSWORD: ${{ secrets.SF_PASSWORD }}
SF_SECURITY_TOKEN: ${{ secrets.SF_SECURITY_TOKEN }}
run: npm run test:integration
```
### Step 2: Configure GitHub Secrets
```bash
# JWT private key (from your RSA key pair)
gh secret set SF_JWT_KEY < server.key
# Connected App consumer key
gh secret set SF_CLIENT_ID --body "3MVG9..."
# Integration user credentials
gh secret set SF_USERNAME --body "ci-user@yourcompany.com"
gh secret set SF_PASSWORD --body "password"
gh secret set SF_SECURITY_TOKEN --body "token"
```
### Step 3: Generate JWT Key Pair
```bash
# Generate RSA key pair for JWT Bearer flow
openssl genrsa -out server.key 2048
openssl req -new -x509 -key server.key -out server.crt -days 365 \
-subj "/CN=Salesforce CI/O=YourCompany"
# Upload server.crt to Connected App in Salesforce Setup:
# Setup > App Manager > Your App > Edit > Use Digital Signatures > Choose File
```
### Step 4: Write Integration Tests
```typescript
import { describe, it, expect } from 'vitest';
import jsforce from 'jsforce';
describe('Salesforce Integration', () => {
const conn = new jsforce.Connection({
loginUrl: process.env.SF_LOGIN_URL || 'https://test.salesforce.com',
});
beforeAll(async () => {
await conn.login(
process.env.SF_USERNAME!,
process.env.SF_PASSWORD! + process.env.SF_SECURITY_TOKEN!
);
});
it('should query Accounts via SOQL', async () => {
const result = await conn.query('SELECT Id, Name FROM Account LIMIT 1');
expect(result.totalSize).toBeGreaterThanOrEqual(0);
expect(result.done).toBe(true);
});
it('should check API limits are not exhausted', async () => {
const limits = await conn.request('/services/data/v59.0/limits/');
const remaining = limits.DailyApiRequests.Remaining;
const max = limits.DailyApiRequests.Max;
expect(remaining / max).toBeGreaterThan(0.1); // At least 10% remaining
});
it('should describe Account sObject', async () => {
const meta = await conn.sobject('Account').describe();
expect(meta.name).toBe('Account');
expect(meta.fields.length).toBeGreaterThan(0);
expect(meta.fields.find(f => f.name === 'Name')).toBeDefined();
});
});
```
### Step 5: Metadata Deployment Pipeline
```yaml
# Deploy on merge to main
deploy:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
needs: [validate, integration-tests]
steps:
- uses: actions/checkout@v4
- name: Install Salesforce CLI
run: npm install -g @salesforce/cli
- name: Authenticate
run: |
echo "${{ secrets.SF_JWT_KEY_PROD }}" > server.key
sf org login jwt \
--client-id ${{ secrets.SF_CLIENT_ID_PROD }} \
--jwt-key-file server.key \
--username ${{ secrets.SF_USERNAME_PROD }} \
--set-default
rm server.key
- name: Deploy to Production
run: |
sf project deploy start \
--target-org ${{ secrets.SF_USERNAME_PROD }} \
--test-level RunLocalTests \
--wait 30
```
## Output
- JWT-authenticated CI pipeline
- Automated Apex test execution on PR
- Integration tests validating jsforce operations
- Metadata deployment on merge to main
- API limit monitoring in CI
## Error Handling
| Issue | Cause | Solution |
|-------|-------|----------|
| `INVALID_GRANT` | JWT cert not uploaded or user not pre-authorized | Upload cert to Connected App; add user to pre-authorized profiles |
| Apex test failures | Test data dependencies | Use `@testSetup` methods for test isolation |
| Deploy validation errors | Missing dependencies | Check component dependencies with `sf project deploy report` |
| API limit in CI | Too many test runs/day | Use sandbox instead of production for CI |
## Resources
- [Salesforce CLI JWT Auth](https://developer.salesforce.com/docs/atlas.en-us.sfdx_dev.meta/sfdx_dev/sfdx_dev_auth_jwt_flow.htm)
- [GitHub Actions Documentation](https://docs.github.com/en/actions)
- [Apex Testing Best Practices](https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_testing.htm)
## Next Steps
For deployment patterns, see `salesforce-deploy-integration`.Related Skills
running-integration-tests
Execute integration tests validating component interactions and system integration. Use when performing specialized testing. Trigger with phrases like "run integration tests", "test integration", or "validate component interactions".
workhuman-deploy-integration
Workhuman deploy integration for employee recognition and rewards API. Use when integrating Workhuman Social Recognition, or building recognition workflows with HRIS systems. Trigger: "workhuman deploy integration".
workhuman-ci-integration
Workhuman ci integration for employee recognition and rewards API. Use when integrating Workhuman Social Recognition, or building recognition workflows with HRIS systems. Trigger: "workhuman ci integration".
wispr-deploy-integration
Wispr Flow deploy integration for voice-to-text API integration. Use when integrating Wispr Flow dictation, WebSocket streaming, or building voice-powered applications. Trigger: "wispr deploy integration".
wispr-ci-integration
Wispr Flow ci integration for voice-to-text API integration. Use when integrating Wispr Flow dictation, WebSocket streaming, or building voice-powered applications. Trigger: "wispr ci integration".
windsurf-ci-integration
Integrate Windsurf Cascade workflows into CI/CD pipelines and team automation. Use when automating Cascade tasks in GitHub Actions, enforcing AI code quality gates, or setting up Windsurf config validation in CI. Trigger with phrases like "windsurf CI", "windsurf GitHub Actions", "windsurf automation", "cascade CI", "windsurf pipeline".
webflow-deploy-integration
Deploy Webflow-powered applications to Vercel, Fly.io, and Google Cloud Run with proper secrets management and Webflow-specific health checks. Trigger with phrases like "deploy webflow", "webflow Vercel", "webflow production deploy", "webflow Cloud Run", "webflow Fly.io".
webflow-ci-integration
Configure Webflow CI/CD with GitHub Actions — automated CMS validation, integration tests with test tokens, and publish-on-merge workflows. Use when setting up automated testing or CI pipelines for Webflow integrations. Trigger with phrases like "webflow CI", "webflow GitHub Actions", "webflow automated tests", "CI webflow", "webflow pipeline".
vercel-deploy-integration
Deploy and manage Vercel production deployments with promotion, rollback, and multi-region strategies. Use when deploying to production, configuring deployment regions, or setting up blue-green deployment patterns on Vercel. Trigger with phrases like "deploy vercel", "vercel production deploy", "vercel promote", "vercel rollback", "vercel regions".
veeva-deploy-integration
Veeva Vault deploy integration for REST API and clinical operations. Use when working with Veeva Vault document management and CRM. Trigger: "veeva deploy integration".
veeva-ci-integration
Veeva Vault ci integration for REST API and clinical operations. Use when working with Veeva Vault document management and CRM. Trigger: "veeva ci integration".
vastai-deploy-integration
Deploy ML training jobs and inference services on Vast.ai GPU cloud. Use when deploying GPU workloads, configuring Docker images, or setting up automated deployment scripts. Trigger with phrases like "deploy vastai", "vastai deployment", "vastai docker", "vastai production deploy".