Skip to content

Commit bcb6305

Browse files
author
Greg Bowler
authored
Merge pull request #85 from attractions-io/custom-ssh-port-support
Custom ssh port support
2 parents 20dfbf4 + 46733de commit bcb6305

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ Installing private repositories
172172

173173
To install from a private repository, SSH authentication must be used. Generate an SSH key pair for this purpose and add it to your private repository's configuration, preferable with only read-only privileges. On Github for instance, this can be done by using [deploy keys][deploy-keys].
174174

175-
Add the key pair to your project using [Github Secrets][secrets], and pass them into the `php-actions/composer` action by using the `ssh_key` and `ssh_key_pub` inputs. If your private repository is stored on another server than github.com, you also need to pass the domain via `ssh_domain`.
175+
Add the key pair to your project using [Github Secrets][secrets], and pass them into the `php-actions/composer` action by using the `ssh_key` and `ssh_key_pub` inputs. If your private repository is stored on another server than github.com, you also need to pass the domain via `ssh_domain`. If the private repository is configured to use a non-standard SSH port, you can configure this by passing `ssh_port`.
176176

177177
Example yaml, showing how to pass secrets:
178178

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
@@ -62,7 +62,12 @@ then
6262

6363
if [ -n "$ACTION_SSH_DOMAIN" ]
6464
then
65-
ssh-keyscan -t rsa "$ACTION_SSH_DOMAIN" >> ~/.ssh/known_hosts
65+
if [ -n "$ACTION_SSH_PORT" ]
66+
then
67+
ssh-keyscan -t rsa -p $ACTION_SSH_PORT "$ACTION_SSH_DOMAIN" >> ~/.ssh/known_hosts
68+
else
69+
ssh-keyscan -t rsa "$ACTION_SSH_DOMAIN" >> ~/.ssh/known_hosts
70+
fi
6671
fi
6772

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

0 commit comments

Comments
 (0)