Skip to content

Commit 8805cce

Browse files
author
Greg Bowler
authored
feature: add memory limit argument
Adds memory limit argument
2 parents 70ed52c + 2793d0f commit 8805cce

File tree

3 files changed

+11
-0
lines changed

3 files changed

+11
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ Any arbitrary arguments can be passed to composer by using the `args` input, how
6161
+ `only_args` - Only run the desired command with this args. Ignoring all other provided arguments(default _empty_)
6262
+ `php_version` - Choose which version of PHP you want to use (7.1, 7.2, 7.3, 7.4 or 8.0)
6363
+ `version` - Choose which version of Composer you want to use (1 or 2)
64+
+ `memory_limit` - Sets the composer memory limit - (default _empty_)
6465

6566
There are also SSH input available: `ssh_key`, `ssh_key_pub` and `ssh_domain` that are used for depending on private repositories. See below for more information on usage.
6667

action.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,10 @@ inputs:
6565
description: Use the given directory as working directory
6666
required: false
6767

68+
memory_limit:
69+
description: Sets the composer memory limit
70+
required: false
71+
6872
outputs:
6973
full_command:
7074
description: "The full command passed to docker to run"
@@ -89,6 +93,7 @@ runs:
8993
ACTION_SSH_KEY_PUB: ${{ inputs.ssh_key_pub }}
9094
ACTION_SSH_DOMAIN: ${{ inputs.ssh_domain }}
9195
ACTION_WORKING_DIR: ${{ inputs.working_dir }}
96+
ACTION_MEMORY_LIMIT: ${{ inputs.memory_limit }}
9297
id: composer_run
9398
run: bash <(curl -s https://raw.githubusercontent.com/php-actions/php-build/330b13bbb1eadd05bbb627477c1549cd7e62e406/php-build.bash) composer \
9499
&& ${{ github.action_path }}/composer-action.bash || { cat ${{ github.workspace }}/output.log ; exit 1; }

composer-action.bash

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,11 @@ else
129129
command_string="$command_string $ACTION_ONLY_ARGS"
130130
fi
131131

132+
if [ -n "$ACTION_MEMORY_LIMIT" ]
133+
then
134+
command_string="COMPOSER_MEMORY_LIMIT=$ACTION_MEMORY_LIMIT $command_string"
135+
fi
136+
132137
echo "Command: $command_string" >> output.log 2>&1
133138
mkdir -p /tmp/composer-cache
134139

0 commit comments

Comments
 (0)