Last active
March 3, 2019 01:59
-
-
Save Jean85/d02e1ce7af41260a5cc22200040d7bba to your computer and use it in GitHub Desktop.
How to check in CI if any Composer dependency can be upgraded, using a committed file as a way to ignore upgrades blocked by external factors.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
rm outdated-status.txt | |
touch outdated-status.txt | |
for package in `composer outdated | awk '{ print $1":"$4 }'`; | |
do | |
echo "New version: $package" > outdated-status.txt | |
composer why-not $package > outdated-status.txt | |
echo "----------" > outdated-status.txt | |
done | |
if [ -z $(git status --porcelain) ]; | |
then | |
echo "Nothing changed" | |
exit 0; | |
else | |
echo "SOMETHING CHANGED, PLEASE UPDATE DEPS!" | |
git diff | |
exit 1 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I've fixed a thing: the file must be erased first, and appendend only after.