Skip to content

Commit 0bc2391

Browse files
authored
Add support for pre/post composer commands (#67)
1 parent ea94183 commit 0bc2391

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,19 @@ _to install dev dependencies:_
4848
args: analyse src/
4949
```
5050
51+
_to execute some command before and/or after composer install:_
52+
```diff
53+
uses: docker://oskarstark/phpstan-ga
54+
+ env:
55+
+ PRE_COMPOSER_COMMANDS:
56+
+ - composer config minimum-stability dev
57+
+ - composer config prefer-stable true
58+
+ POST_COMPOSER_COMMANDS:
59+
+ - composer outdated
60+
with:
61+
args: analyse src/
62+
```
63+
5164
_to skip checking the platform requirements:_
5265
```diff
5366
uses: docker://oskarstark/phpstan-ga

entrypoint.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,21 @@ if [ "$REQUIRE_DEV" = "true" ]; then
1818
NO_DEV=""
1919
fi
2020

21+
if [ -z "$PRE_COMPOSER_COMMANDS" ]; then
22+
for str in ${PRE_COMPOSER_COMMANDS[@]}; do
23+
eval "$str"
24+
done
25+
fi
26+
2127
COMPOSER_COMMAND="composer install --no-progress $NO_DEV $IGNORE_PLATFORM_REQS"
2228
echo "::group::$COMPOSER_COMMAND"
29+
30+
if [ -z "$POST_COMPOSER_COMMANDS" ]; then
31+
for str in ${POST_COMPOSER_COMMANDS[@]}; do
32+
eval "$str"
33+
done
34+
fi
35+
2336
$COMPOSER_COMMAND
2437
echo "::endgroup::"
2538
/composer/vendor/bin/phpstan $*

0 commit comments

Comments
 (0)