Skip to content

Commit

Permalink
feat(action): add sandbox create & refresh (#7)
Browse files Browse the repository at this point in the history
  • Loading branch information
nkskaare authored May 8, 2024
1 parent 31e56d0 commit 7a70345
Show file tree
Hide file tree
Showing 3 changed files with 84 additions and 0 deletions.
44 changes: 44 additions & 0 deletions .github/workflows/create-sandbox.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: "Create Salesforce Sandbox"

on:
workflow_call:
inputs:
definition_file:
description: "Path to definition file"
required: true
type: string
sandbox_name:
description: "Sandbox Name"
required: true
type: string
license:
description: "Sandbox license"
required: false
type: string
default: Developer
secrets:
DEVHUB_SFDX_AUTH_URL:
description: "Devhub auth url"
required: true

jobs:
create-sandbox:
runs-on: ubuntu-latest
container:
image: flxbl-io/sfp-rc:Mar-23

steps:
- uses: actions/checkout@v3
with:
ref: ${{ inputs.git-ref }}
fetch-depth: 0

- name: 'Authenticate Dev Hub'
run: |
echo "${{ secrets.DEVHUB_SFDX_AUTH_URL }}" > ./authfile
sf org login sfdx-url -f authfile -a devhub
- name: Create Salesforce Sandbox
run: |
sf org create sandbox --alias ${{ inputs.sandbox_name }} -f ${{ inputs.definition_file }} \
-l ${{ inputs.license }} --name ${{ inputs.sandbox_name }} --target-org devhub --no-prompt --async
39 changes: 39 additions & 0 deletions .github/workflows/refresh-sandbox.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: "Refresh Salesforce Sandbox"

on:
workflow_call:
inputs:
sandbox_name:
description: "Sandbox Name"
required: true
type: string
definition_file:
description: "Path to definition file"
required: true
type: string
secrets:
DEVHUB_SFDX_AUTH_URL:
description: "Devhub auth url"
required: true

jobs:
create-sandbox:
runs-on: ubuntu-latest
container:
image: flxbl-io/sfp-rc:Mar-23

steps:
- uses: actions/checkout@v3
with:
ref: ${{ inputs.git-ref }}
fetch-depth: 0

- name: 'Authenticate Dev Hub'
run: |
echo "${{ secrets.DEVHUB_SFDX_AUTH_URL }}" > ./authfile
sf org login sfdx-url -f authfile -a devhub
- name: Refresh Salesforce Sandbox
run: |
sf org refresh sandbox -f ${{ inputs.definition_file }} \
--name ${{ inputs.sandbox_name }} --target-org devhub --no-prompt --async
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules/

0 comments on commit 7a70345

Please sign in to comment.