Skip to content
This repository has been archived by the owner on Jan 9, 2024. It is now read-only.

build(deps-dev): bump prettier from 2.8.7 to 2.8.8 #210

build(deps-dev): bump prettier from 2.8.7 to 2.8.8

build(deps-dev): bump prettier from 2.8.7 to 2.8.8 #210

Workflow file for this run

# Unique name for this workflow
name: CI on PR
# Definition when the workflow should run
on:
workflow_dispatch:
pull_request:
types: [opened, edited, synchronize, reopened]
branches-ignore:
- prerelease/spring[2-9][0-9]
- prerelease/summer[2-9][0-9]
- prerelease/winter[2-9][0-9]
# Jobs to be executed
jobs:
# Dummy job used to skip CI run on automated PRs
skip-ci:
if: "github.actor == 'trailheadapps-bot'"
runs-on: trailheadapps-Ubuntu
steps:
- name: Noop
run: |
echo "Skipping CI run for automated PRs."
# Formatting and linting only runs on human-submitted PRs
format-lint:
if: "github.actor != 'trailheadapps-bot'"
runs-on: trailheadapps-Ubuntu
steps:
# Checkout the source code
- name: 'Checkout source code'
uses: actions/checkout@v3
# Install Volta to enforce proper node and package manager versions
- name: 'Install Volta'
uses: volta-cli/action@v4
# Cache node_modules to speed up the process
- name: 'Restore node_modules cache'
id: cache-npm
uses: actions/cache@v3
with:
path: node_modules
key: npm-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
npm-${{ env.cache-name }}-
npm-
# Install npm dependencies
- name: 'Install npm dependencies'
if: steps.cache-npm.outputs.cache-hit != 'true'
run: npm ci
# Prettier formatting
- name: 'Code formatting verification with Prettier'
run: npm run prettier:verify
# Lint JavaScript code
- name: 'Lint JavaScript code'
run: npm run lint
# Auto merge Dependabot PRs for:
# - patch updates on prod dependencies
# - minor updates on dev dependencies
dependabot-auto-merge:
# Only run for Dependabot PRs
if: ${{ github.actor == 'dependabot[bot]' }}
runs-on: trailheadapps-Ubuntu
needs: format-lint
permissions:
pull-requests: write
contents: write
steps:
- name: 'Fetch Dependabot metadata'
id: dependabot
uses: dependabot/fetch-metadata@v1
- name: 'Check auto merge conditions'
id: auto-merge
if: |
(
steps.dependabot.outputs.update-type == 'version-update:semver-patch' &&
contains('direct:production,indirect:production', steps.dependabot.outputs.dependency-type)
) || (
contains('version-update:semver-minor,version-update:semver-patch', steps.dependabot.outputs.update-type) &&
contains('direct:development,indirect:development', steps.dependabot.outputs.dependency-type)
)
run: echo "::notice ::auto-merge conditions satisfied"
- name: 'Approve and merge PR'
if: ${{ steps.auto-merge.conclusion == 'success' }}
run: |
gh pr review --approve "$PR_URL"
gh pr merge --auto --rebase "$PR_URL"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PR_URL: ${{ github.event.pull_request.html_url }}
scratch-org-test:
runs-on: trailheadapps-Ubuntu
needs: format-lint
if: ${{ github.actor != 'dependabot[bot]' }}
steps:
# Install Salesforce CLI
- name: 'Install Salesforce CLI'
run: |
npm install sfdx-cli --location=global
nodeInstallPath=$(npm config get prefix)
echo "$nodeInstallPath/bin" >> $GITHUB_PATH
sfdx --version
# Checkout the source code
- name: 'Checkout source code'
uses: actions/checkout@v3
# Store secret for dev hub
- name: 'Populate auth file with DEVHUB_SFDX_URL secret'
shell: bash
run: |
echo ${{ secrets.DEVHUB_SFDX_URL}} > ./DEVHUB_SFDX_URL.txt
secretFileSize=$(wc -c "./DEVHUB_SFDX_URL.txt" | awk '{print $1}')
if [ $secretFileSize == 1 ]; then
echo "Missing DEVHUB_SFDX_URL secret. Is this workflow running on a fork?";
exit 1;
fi
# Authenticate dev hub
- name: 'Authenticate Dev Hub'
run: sfdx auth:sfdxurl:store -f ./DEVHUB_SFDX_URL.txt -a devhub -d
# Create scratch org
- name: 'Create scratch org'
run: sfdx force:org:create -f config/project-scratch-def.json -a scratch-org -s -d 1
# Deploy source to scratch org
- name: 'Push source to scratch org'
run: sfdx force:source:push
# Assign permissionset
- name: 'Assign permissionset to default user'
run: sfdx force:user:permset:assign -n Ready_to_Fly
# Import sample data
- name: 'Import sample data'
run: sfdx force:apex:execute --apexcodefile data/setup.apex
# Run Apex tests in scratch org
- name: 'Run Apex tests'
run: sfdx force:apex:test:run -c -r human -d ./tests/apex -w 20
# Upload code coverage data
- name: 'Upload code coverage for Apex to Codecov.io'
uses: codecov/codecov-action@v3
with:
flags: Apex
# Housekeeping
- name: 'Delete scratch org'
if: always()
run: sfdx force:org:delete -p -u scratch-org