|
12 | 12 | - opened |
13 | 13 | - synchronize |
14 | 14 | - reopened |
15 | | - |
16 | | -jobs: |
17 | | - validate_scratch_deploy: |
18 | | - runs-on: ubuntu-latest |
19 | | - steps: |
20 | | - # Install Salesforce CLI |
21 | | - - name: Install Salesforce CLI |
22 | | - run: | |
23 | | - npm install @salesforce/cli --location=global |
24 | | - nodeInstallPath=$(npm config get prefix) |
25 | | - echo "$nodeInstallPath/bin" >> $GITHUB_PATH |
26 | | - sf --version |
27 | | -
|
28 | | - # Checkout the code in the pull request |
29 | | - - name: Checkout source code |
30 | | - uses: actions/checkout@v3 |
31 | | - |
32 | | - # Load secret for dev hub |
33 | | - - name: Populate auth file with SFDX_URL secret |
34 | | - shell: bash |
35 | | - run: "echo ${{ secrets.SFDX_AUTH_URL }} > ./SFDX_URL_STORE.txt" |
36 | | - |
37 | | - # Authenticate with dev hub |
38 | | - - name: Authenticate with dev hub |
39 | | - run: sf org login sfdx-url -f ./SFDX_URL_STORE.txt -a LibakDevHub -d |
40 | | - |
41 | | - # Run Apex Tests |
42 | | - - name: Deployment Validation |
43 | | - id: run_tests |
44 | | - run: | |
45 | | - sf project deploy start --test-level RunLocalTests --dry-run --json --target-org LibakDevHub > validation_result.json || true |
46 | | -
|
47 | | - # Post Comment on PR if Tests Fail or Coverage is Low |
48 | | - - name: Post Comment on PR |
49 | | - uses: actions/github-script@v6 |
50 | | - with: |
51 | | - script: | |
52 | | - const fs = require('fs'); |
53 | | - const deploymentResult = JSON.parse(fs.readFileSync('./validation_result.json', 'utf8')); |
54 | | - |
55 | | - const message = require('./CI/scripts/validation_comment.js')(deploymentResult); |
56 | | -
|
57 | | - await github.rest.issues.createComment({ |
58 | | - ...context.repo, |
59 | | - issue_number: context.payload.pull_request?.number, |
60 | | - body: message |
61 | | - }); |
62 | | -
|
63 | | - if(deploymentResult.status === 1) { |
64 | | - throw new Error('Deployment Validation was failed. See Pull Request comments.') |
65 | | - } |
66 | 15 |
|
| 16 | +jobs: |
| 17 | + deploy_verification: |
| 18 | + uses: akohan91/libak-salesforce-ci/.github/workflows/deployment_validation.yaml@main |
| 19 | + secrets: inherit |
0 commit comments