Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions .github/actions/authorize-dev-hub/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Composite action that authorizes the Salesforce Dev Hub via JWT and sets
# it as the default. All inputs are required.
name: 'Authorize Dev Hub'
description: 'Authorize the Salesforce Dev Hub via JWT and set it as the default'

inputs:
auth-url:
description: 'Dev Hub login URL'
required: true
bot-username:
description: 'Dev Hub bot username'
required: true
consumer-key:
description: 'Dev Hub connected app consumer key'
required: true
jwt-server-key:
description: 'Dev Hub JWT private key (PEM)'
required: true

runs:
using: 'composite'
steps:
# The key file must remain on disk for the rest of the job. The SF CLI records the
# key's path (not its contents) in ~/.sfdx/ and re-reads it whenever it has to refresh
# the JWT - including the implicit re-auth that `sf org create scratch` performs when
# authenticating into the new scratch org. Deleting the file mid-job causes ENOENT on
# the next refresh. Cleanup is unnecessary anyway: GitHub-hosted runners are single-use
# ephemeral VMs that get wiped after the job ends.
- name: 'Authorize Dev Hub'
shell: bash
env:
DEV_HUB_AUTH_URL: ${{ inputs.auth-url }}
DEV_HUB_BOT_USERNAME: ${{ inputs.bot-username }}
DEV_HUB_CONSUMER_KEY: ${{ inputs.consumer-key }}
DEV_HUB_JWT_SERVER_KEY: ${{ inputs.jwt-server-key }}
run: |
npx sf version
echo "$DEV_HUB_JWT_SERVER_KEY" > ./jwt-server.key
npx sf org login jwt --instance-url "$DEV_HUB_AUTH_URL" --client-id "$DEV_HUB_CONSUMER_KEY" --username "$DEV_HUB_BOT_USERNAME" --jwt-key-file ./jwt-server.key --set-default-dev-hub
28 changes: 28 additions & 0 deletions .github/actions/setup-npm/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Composite action that restores the node_modules cache and installs
# npm dependencies on a cache miss. Used by every job in build.yml.
name: 'Setup npm'
description: 'Restore the node_modules cache and run npm ci on a cache miss'

runs:
using: 'composite'
steps:
- name: 'Restore node_modules cache'
id: cache-npm
uses: actions/cache@v5
with:
path: node_modules
key: npm-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
npm-${{ env.cache-name }}-
npm-

- name: 'Install npm dependencies'
if: steps.cache-npm.outputs.cache-hit != 'true'
shell: bash
run: npm ci

- name: 'Link sf CLI plugins from node_modules'
shell: bash
run: |
npm run sf:plugins:link:bummer
npm run sf:plugins:link:dotenv
Loading