@@ -474,24 +474,11 @@ async function createCodeDeployDeployment(codedeploy, clusterName, service, task
474474
475475async function run() {
476476 try {
477- const maxRetries = parseInt(core.getInput('max-retries', { required: false })) || 3;
478-
479- const ecs = new ECS({
480- customUserAgent: 'amazon-ecs-deploy-task-definition-for-github-actions',
481- maxAttempts: maxRetries,
482- retryMode: 'standard'
483- });
484-
485- const codedeploy = new CodeDeploy({
486- customUserAgent: 'amazon-ecs-deploy-task-definition-for-github-actions',
487- maxAttempts: maxRetries,
488- retryMode: 'standard'
489- });
490-
491477 // Get inputs
492478 const taskDefinitionFile = core.getInput('task-definition', { required: true });
493479 const service = core.getInput('service', { required: false });
494480 const cluster = core.getInput('cluster', { required: false });
481+ const maxRetries = parseInt(core.getInput('max-retries', { required: false })) || 3;
495482 const waitForService = core.getInput('wait-for-service-stability', { required: false });
496483 let waitForMinutes = parseInt(core.getInput('wait-for-minutes', { required: false })) || 30;
497484
@@ -520,6 +507,17 @@ async function run() {
520507 if (keepNullValueKeysInput) {
521508 keepNullValueKeys = keepNullValueKeysInput.split(',').map(k => k.trim()).filter(Boolean);
522509 }
510+ const ecs = new ECS({
511+ customUserAgent: 'amazon-ecs-deploy-task-definition-for-github-actions',
512+ maxAttempts: maxRetries,
513+ retryMode: 'standard'
514+ });
515+
516+ const codedeploy = new CodeDeploy({
517+ customUserAgent: 'amazon-ecs-deploy-task-definition-for-github-actions',
518+ maxAttempts: maxRetries,
519+ retryMode: 'standard'
520+ });
523521
524522 // Register the task definition
525523 core.debug('Registering the task definition');
0 commit comments