Skip to content

Commit

Permalink
Merge pull request tiagonnascimento#16 from trilogy-group/master
Browse files Browse the repository at this point in the history
Sfdx root folder parameter added;
  • Loading branch information
tiagonnascimento authored Apr 30, 2021
2 parents aafcd05 + 1ac48b1 commit a8a4f8c
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 6,692 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ jobs:
| `client_id` | _required_ | Client ID that will be used to connect into the target org/sandbox |
| `username` | _required_ | Username that will be used to connect into the target org/sandbox |
| `checkonly` | _required_ | Boolean value to indicate whether this action should execute the deploy or only check it, default is false, but if true it will add -c parameter on the force:mdapi:deploy commands |
| `manifest_path` | _required_ | Path on the current repository to one or more package.xml that represents the packages to be deployed. Based on this files the metadata package will be created and deployed in the order specified. Ex: | manifest/package-01.xml,manifest/package-02.xml,manifest/package-03.xml
| `manifest_path` | _required_ | Path on the current repository (or on the root folder of the sfdx project if sfdx_root_folder is set) to one or more package.xml that represents the packages to be deployed. Based on this files the metadata package will be created and deployed in the order specified. Ex: | manifest/package-01.xml,manifest/package-02.xml,manifest/package-03.xml
| `sfdx_root_folder` | _optional_ | Path on the current repository to the root folder of sfdx folder. Ex: sfdx_project
| `deploy_testlevel` | _optional_ | TestLevel applied on the deploy. Default is `RunLocalTests`. If specified `RunSpecifiedTests`, the action will execute only the classes mentioned in the manifest file that contains `@isTest` tag |
| `deploy_wait_time` | _optional_ | Wait time for deployment to finish in minutes. Default is `60` |
| `destructive_path` | _optional_ | Path on the repo where the destructive changes directory is - if not informed, it's not executed |
Expand Down
6 changes: 5 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,12 @@ inputs:
required: true
default: true

sfdx_root_folder:
description: 'Path on the current repository to the root folder of the sfdx project'
required: false

manifest_path:
description: 'Path on the current repository to one or more package.xml that represents the packages to be deployed. Based on this files the metadata package will be created and deployed in the order specified'
description: 'Path on the current repository (or on the root folder of the sfdx project if sfdx_root_folder is set) to one or more package.xml that represents the packages to be deployed. Based on this files the metadata package will be created and deployed in the order specified'
required: true

deploy_testlevel:
Expand Down
16 changes: 11 additions & 5 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13208,6 +13208,7 @@ try {
deploy.defaultSourcePath = core.getInput('default_source_path');
deploy.defaultTestClass = core.getInput('default_test_class');
deploy.manifestToDeploy = core.getInput('manifest_path');
deploy.sfdxRootFolder = core.getInput('sfdx_root_folder');
deploy.destructivePath = core.getInput('destructive_path');
deploy.dataFactory = core.getInput('data_factory');
deploy.checkonly = (core.getInput('checkonly') === 'true' )? true : false;
Expand Down Expand Up @@ -13240,13 +13241,15 @@ try {
const core = __webpack_require__(2186)
const { spawnSync } = __webpack_require__(3129);

module.exports.run = function(command, args) {
module.exports.run = function(command, args, workingFolder = null) {
var extraParams = {};

//extraParams.shell = true;
//extraParams.cwd = process.cwd();
//extraParams.env = process.env;
//extraParams.stdio = [process.stdin, process.stdout , process.stderr];
if (workingFolder) {
extraParams.cwd = workingFolder;
}
extraParams.encoding = 'utf-8';
extraParams.maxBuffer = 1024 * 1024 * 10

Expand Down Expand Up @@ -13305,6 +13308,7 @@ module.exports.install = function(command, args) {
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

const core = __webpack_require__(2186)
const path = __webpack_require__(5622);
const execCommand = __webpack_require__(5505);
const fs = __webpack_require__(5747);
const xml2js = __webpack_require__(6189);
Expand Down Expand Up @@ -13361,6 +13365,8 @@ let deploy = function (deploy){
core.info("=== deploy ===");

var manifestsArray = deploy.manifestToDeploy.split(",");
var sfdxRootFolder = deploy.sfdxRootFolder;

var manifestTmp;
var testClassesTmp;

Expand All @@ -13375,9 +13381,9 @@ let deploy = function (deploy){
}

if(deploy.testlevel == "RunSpecifiedTests"){
testClassesTmp = getApexTestClass(manifestTmp, deploy.defaultSourcePath+'/classes', deploy.defaultTestClass);
testClassesTmp = getApexTestClass(sfdxRootFolder ? path.join(sfdxRootFolder, manifestTmp) : manifestTmp, deploy.defaultSourcePath + '/classes', deploy.defaultTestClass);

core.info("las clases son : " + testClassesTmp);
core.info("classes are : " + testClassesTmp);

if(testClassesTmp){
argsDeploy.push("--testlevel");
Expand All @@ -13394,7 +13400,7 @@ let deploy = function (deploy){
argsDeploy.push(deploy.testlevel);
}

execCommand.run('sfdx', argsDeploy);
execCommand.run('sfdx', argsDeploy, sfdxRootFolder);
}
};

Expand Down
Loading

0 comments on commit a8a4f8c

Please sign in to comment.