Skip to content

Commit 91c5c18

Browse files
committed
Refactor for readability
1 parent de84787 commit 91c5c18

File tree

1 file changed

+12
-14
lines changed

1 file changed

+12
-14
lines changed

index.js

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -468,24 +468,11 @@ async function createCodeDeployDeployment(codedeploy, clusterName, service, task
468468

469469
async function run() {
470470
try {
471-
const maxRetries = parseInt(core.getInput('max-retries', { required: false })) || 3;
472-
473-
const ecs = new ECS({
474-
customUserAgent: 'amazon-ecs-deploy-task-definition-for-github-actions',
475-
maxAttempts: maxRetries,
476-
retryMode: 'standard'
477-
});
478-
479-
const codedeploy = new CodeDeploy({
480-
customUserAgent: 'amazon-ecs-deploy-task-definition-for-github-actions',
481-
maxAttempts: maxRetries,
482-
retryMode: 'standard'
483-
});
484-
485471
// Get inputs
486472
const taskDefinitionFile = core.getInput('task-definition', { required: true });
487473
const service = core.getInput('service', { required: false });
488474
const cluster = core.getInput('cluster', { required: false });
475+
const maxRetries = parseInt(core.getInput('max-retries', { required: false })) || 3;
489476
const waitForService = core.getInput('wait-for-service-stability', { required: false });
490477
let waitForMinutes = parseInt(core.getInput('wait-for-minutes', { required: false })) || 30;
491478

@@ -514,6 +501,17 @@ async function run() {
514501
if (keepNullValueKeysInput) {
515502
keepNullValueKeys = keepNullValueKeysInput.split(',').map(k => k.trim()).filter(Boolean);
516503
}
504+
const ecs = new ECS({
505+
customUserAgent: 'amazon-ecs-deploy-task-definition-for-github-actions',
506+
maxAttempts: maxRetries,
507+
retryMode: 'standard'
508+
});
509+
510+
const codedeploy = new CodeDeploy({
511+
customUserAgent: 'amazon-ecs-deploy-task-definition-for-github-actions',
512+
maxAttempts: maxRetries,
513+
retryMode: 'standard'
514+
});
517515

518516
// Register the task definition
519517
core.debug('Registering the task definition');

0 commit comments

Comments
 (0)