Skip to content

Add app folder #103

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Aug 31, 2023
Merged
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
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ Any arbitrary arguments can be passed to composer by using the `args` input, how
+ `php_version` - Choose which version of PHP you want to use - x.y (default `latest`) (e.g. `7.4.29`, 8.2`, or any version listed on https://www.php.net/releases/index.php)
+ `version` - Choose which version of Composer you want to use - default `latest` (e.g. `1.10`, `2.3`, `2.5.4`)
+ `memory_limit` - Sets the composer memory limit - (default _empty_)
+ `container_workdir` - Sets the aplication workdir inside container - (default /app)

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.

Expand Down Expand Up @@ -113,6 +114,20 @@ jobs:
version: 1
```

Execute composer install in a different folder
-------------------------------------------

```yaml
- name: Install dependencies
uses: "php-actions/composer@v6"
env:
COMPOSER: "composer.json"
with:
php_version: "5.6.40"
version: "2.2"
args: "--ignore-platform-reqs --optimize-autoloader"
working_dir: "my/different/folder"
```

Including PHP Extensions
-------------------------------------------
Expand Down
5 changes: 5 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@ inputs:
description: "Sets the composer memory limit"
required: false

container_workdir:
description: "Sets the aplication workdir inside container"
required: false

outputs:
full_command:
description: "The full command passed to docker to run"
Expand All @@ -99,6 +103,7 @@ runs:
ACTION_SSH_PORT: ${{ inputs.ssh_port }}
ACTION_WORKING_DIR: ${{ inputs.working_dir }}
ACTION_MEMORY_LIMIT: ${{ inputs.memory_limit }}
ACTION_CONTAINER_WORKDIR: ${{ inputs.container_workdir }}
id: composer_run
run: |
set -e
Expand Down
8 changes: 7 additions & 1 deletion composer-action.bash
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/bin/bash
set -e

container_workdir="/app"
github_action_path=$(dirname "$0")
docker_tag=$(cat ./docker_tag)
echo "Docker tag: $docker_tag" >> output.log 2>&1
Expand Down Expand Up @@ -194,6 +196,10 @@ do
fi
done <<<$(env)

if [ -z "$ACTION_CONTAINER_WORKDIR" ]; then
container_workdir="${ACTION_CONTAINER_WORKDIR}"
fi

echo "name=full_command::${command_string}" >> $GITHUB_OUTPUT

docker run --rm \
Expand All @@ -202,7 +208,7 @@ docker run --rm \
--volume ~/.ssh:/root/.ssh \
--volume "${GITHUB_WORKSPACE}":/app \
--volume "/tmp/composer-cache":/tmp/composer-cache \
--workdir /app \
--workdir ${container_workdir} \
--env-file ./DOCKER_ENV \
--network host \
${memory_limit} \
Expand Down