Skip to content

Commit 40c40a4

Browse files
authored
Merge pull request #6 from akohan91/feature/improve-github-actions-with-centralized-repo
Feature/improve GitHub actions with centralized repo
2 parents 6ea5557 + 3cda8e1 commit 40c40a4

9 files changed

+4
-855
lines changed

.github/workflows/deployment_validation.yaml

Lines changed: 4 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -12,55 +12,8 @@ on:
1212
- opened
1313
- synchronize
1414
- 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-
}
6615

16+
jobs:
17+
deploy_verification:
18+
uses: akohan91/libak-salesforce-ci/.github/workflows/deployment_validation.yaml@main
19+
secrets: inherit

CI/scripts/validation_comment.js

Lines changed: 0 additions & 57 deletions
This file was deleted.

CI/scripts/validation_comment_tests/test_validation_result_mock_components_fail.js

Lines changed: 0 additions & 124 deletions
This file was deleted.

CI/scripts/validation_comment_tests/test_validation_result_mock_components_fail.md

Lines changed: 0 additions & 13 deletions
This file was deleted.

0 commit comments

Comments
 (0)