Skip to content

Instantly share code, notes, and snippets.

@Jean85
Last active March 3, 2019 01:59
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save Jean85/d02e1ce7af41260a5cc22200040d7bba to your computer and use it in GitHub Desktop.
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.
#!/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
@Jean85
Copy link
Author

Jean85 commented Feb 22, 2019

I've fixed a thing: the file must be erased first, and appendend only after.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment