Skip to content

Commit 521a62f

Browse files
committed
Add support for custom ssh port when using ssh_domain option
1 parent 07d9028 commit 521a62f

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

action.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,10 @@ inputs:
6161
description: The domain to gather SSH public keys for (automatic for github.com, gitlab.com, bitbucket.org)
6262
required: false
6363

64+
ssh_port:
65+
description: Custom port to use in conjunction with ssh_domain
66+
required: false
67+
6468
working_dir:
6569
description: Use the given directory as working directory
6670
required: false
@@ -92,6 +96,7 @@ runs:
9296
ACTION_SSH_KEY: ${{ inputs.ssh_key }}
9397
ACTION_SSH_KEY_PUB: ${{ inputs.ssh_key_pub }}
9498
ACTION_SSH_DOMAIN: ${{ inputs.ssh_domain }}
99+
ACTION_SSH_PORT: ${{ inputs.ssh_port }}
95100
ACTION_WORKING_DIR: ${{ inputs.working_dir }}
96101
ACTION_MEMORY_LIMIT: ${{ inputs.memory_limit }}
97102
id: composer_run

composer-action.bash

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,12 @@ then
3333

3434
if [ -n "$ACTION_SSH_DOMAIN" ]
3535
then
36-
ssh-keyscan -t rsa "$ACTION_SSH_DOMAIN" >> ~/.ssh/known_hosts
36+
if [ -n "$ACTION_SSH_PORT" ]
37+
then
38+
ssh-keyscan -t rsa -p $ACTION_SSH_PORT "$ACTION_SSH_DOMAIN" >> ~/.ssh/known_hosts
39+
else
40+
ssh-keyscan -t rsa "$ACTION_SSH_DOMAIN" >> ~/.ssh/known_hosts
41+
fi
3742
fi
3843

3944
echo "$ACTION_SSH_KEY" > ~/.ssh/action_rsa

0 commit comments

Comments
 (0)