Skip to content

Commit 7cd0f97

Browse files
authored
Merge pull request #49 from ergebnis/feature/working-directory
Enhancement: Add `working-directory` input for `composer/install` action
2 parents fd8aa04 + 44ca474 commit 7cd0f97

File tree

3 files changed

+28
-5
lines changed

3 files changed

+28
-5
lines changed

CHANGELOG.md

+13-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,15 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66

77
## Unreleased
88

9-
For a full diff see [`1.0.0...main`][1.0.0...main].
9+
For a full diff see [`1.1.0...main`][1.1.0...main].
10+
11+
## [`1.1.0`][1.1.0]
12+
13+
For a full diff see [`1.0.0...1.1.0`][1.0.0...1.1.0].
14+
15+
### Added
16+
17+
- Added a `working-directory` input for the `composer/install` action ([#49]), by [@localheinz]
1018

1119
## [`1.0.0`][1.0.0]
1220

@@ -17,10 +25,13 @@ For a full diff see [`1.0.0...main`][1.0.0...main].
1725
- Added composite actions for determining the `composer` cache directory and installing dependencies with `composer` ([#47]), by [@localheinz]
1826

1927
[1.0.0]: https://github.com/ergebnis/.github/releases/tag/1.0.0
28+
[1.1.0]: https://github.com/ergebnis/.github/releases/tag/1.1.0
2029

2130
[ca7f15d...1.0.0]: https://github.com/ergebnis/php-package-template/compare/ca7f15d...1.0.0
22-
[1.0.0...main]: https://github.com/ergebnis/php-package-template/compare/1.0.0...main
31+
[1.0.0...1.1.0]: https://github.com/ergebnis/php-package-template/compare/1.0.0...1.1.0
32+
[1.1.0...main]: https://github.com/ergebnis/php-package-template/compare/1.1.0...main
2333

2434
[#47]: https://github.com/ergebnis/.github/pull/47
35+
[#48]: https://github.com/ergebnis/.github/pull/48
2536

2637
[@localheinz]: https://github.com/localheinz

actions/composer/install/action.yaml

+5
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ inputs:
1212
default: "locked"
1313
description: "Which dependencies to install, one of \"lowest\", \"locked\", \"highest\""
1414
required: true
15+
working-directory:
16+
default: "."
17+
description: "Which directory to use as working directory"
18+
required: true
1519

1620
runs:
1721
using: "composite"
@@ -20,5 +24,6 @@ runs:
2024
- name: "Install ${{ inputs.dependencies }} dependencies with composer"
2125
env:
2226
COMPOSER_INSTALL_DEPENDENCIES: "${{ inputs.dependencies }}"
27+
COMPOSER_INSTALL_WORKING_DIRECTORY: "${{ inputs.working-directory }}"
2328
run: "${{ github.action_path }}/run.sh"
2429
shell: "bash"

actions/composer/install/run.sh

+10-3
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,28 @@
11
#!/usr/bin/env bash
22

33
dependencies="${COMPOSER_INSTALL_DEPENDENCIES}"
4+
workingDirectory="${COMPOSER_INSTALL_WORKING_DIRECTORY}"
5+
6+
if [[ ! -d ${workingDirectory} ]]; then
7+
echo "::error::The value for the \"working-directory\" input needs to be an existing directory. The directory \"${workingDirectory}\" does not exist."
8+
9+
exit 1;
10+
fi
411

512
if [[ ${dependencies} == "lowest" ]]; then
6-
composer update --ansi --no-interaction --no-progress --prefer-lowest
13+
composer update --ansi --no-interaction --no-progress --prefer-lowest -working-dir="${workingDirectory}"
714

815
exit $?
916
fi
1017

1118
if [[ ${dependencies} == "locked" ]]; then
12-
composer install --ansi --no-interaction --no-progress
19+
composer install --ansi --no-interaction --no-progress -working-dir="${workingDirectory}"
1320

1421
exit $?
1522
fi
1623

1724
if [[ ${dependencies} == "highest" ]]; then
18-
composer update --ansi --no-interaction --no-progress
25+
composer update --ansi --no-interaction --no-progress -working-dir="${workingDirectory}"
1926

2027
exit $?
2128
fi

0 commit comments

Comments
 (0)