Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ inputs:
run-task-started-by:
description: "A name to use for the startedBy tag when running a task outside of a service. Will default to 'GitHub-Actions'."
required: false
run-task-assign-public-ip:
description: "A boolean indicating whether to assign a public IP to the task."
required: false
wait-for-task-stopped:
description: 'Whether to wait for the task to stop when running it outside of a service. Will default to not wait.'
required: false
Expand Down
5 changes: 5 additions & 0 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ async function runTask(ecs, clusterName, taskDefArn, waitForMinutes) {
const launchType = core.getInput('run-task-launch-type', { required: false }) || 'FARGATE';
const subnetIds = core.getInput('run-task-subnets', { required: false }) || '';
const securityGroupIds = core.getInput('run-task-security-groups', { required: false }) || '';
const assignPublicIp = core.getInput('run-task-assign-public-ip', { required: false }) || '';
const containerOverrides = JSON.parse(core.getInput('run-task-container-overrides', { required: false }) || '[]');
let awsvpcConfiguration = {}

Expand All @@ -47,6 +48,10 @@ async function runTask(ecs, clusterName, taskDefArn, waitForMinutes) {
awsvpcConfiguration["securityGroups"] = securityGroupIds.split(',')
}

if (assignPublicIp != "") {
awsvpcConfiguration["assignPublicIp"] = assignPublicIp ? "ENABLED" : "DISABLED"
}

const runTaskResponse = await ecs.runTask({
startedBy: startedBy,
cluster: clusterName,
Expand Down
5 changes: 5 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ async function runTask(ecs, clusterName, taskDefArn, waitForMinutes) {
const launchType = core.getInput('run-task-launch-type', { required: false }) || 'FARGATE';
const subnetIds = core.getInput('run-task-subnets', { required: false }) || '';
const securityGroupIds = core.getInput('run-task-security-groups', { required: false }) || '';
const assignPublicIp = core.getInput('run-task-assign-public-ip', { required: false }) || '';
const containerOverrides = JSON.parse(core.getInput('run-task-container-overrides', { required: false }) || '[]');
let awsvpcConfiguration = {}

Expand All @@ -41,6 +42,10 @@ async function runTask(ecs, clusterName, taskDefArn, waitForMinutes) {
awsvpcConfiguration["securityGroups"] = securityGroupIds.split(',')
}

if (assignPublicIp != "") {
awsvpcConfiguration["assignPublicIp"] = assignPublicIp ? "ENABLED" : "DISABLED"
}

const runTaskResponse = await ecs.runTask({
startedBy: startedBy,
cluster: clusterName,
Expand Down