This repository implements a simple GitHub composite action for uploading records to any kind of Salesforce org from within CI/CD automations based on CSV (Bulk API 2.0) or JSON (sObject Tree) format.
After installing the SF CLI and authorizing the relevant org in your GitHub workflow, data can be imported using this action as follows:
jobs:
validation:
name: Validation
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Select Node Version
uses: svierk/get-node-version@main
- name: Install Dependencies
run: npm ci
- name: Install SF CLI
uses: svierk/sfdx-cli-setup@main
- name: Salesforce Org Login
uses: svierk/sfdx-login@main
with:
sfdx-url: ${{ secrets.SFDX_AUTH_URL }}
alias: awesome-org
- name: CSV Data Import
uses: svierk/sfdx-data-import@main
with:
file-path: './data/accounts.csv'
object-type: 'Account'
external-id: 'Id'
target-org: awesome-org
- name: JSON Data Import
uses: svierk/sfdx-data-import@main
with:
file-path: './data/accounts.json,./data/contacts.json'
api-version: '59.0'
The following actions were also used in the example workflow to create the prerequisites for the data import:
- Get Node Version | Pulls Node.js version to be used from the package.json of the project
- SFDX CLI Setup | Installs the Salesforce CLI and related plugins
- SFDX Login | Handles Salesforce login using a Salesforce DX authorization URL
Of course, the data import action can be used flexibly and the respective approach can vary.
The data import options supported by this GitHub composite action can be found in the Salesforce CLI Command Reference here:
- data import tree (JSON format)
- data upsert bulk (CSV format)
Latest release notes can be found on the release page.
The scripts and documentation in this project are released under the MIT License.