Skip to content

Commit

Permalink
make check-for-external-updates directly callable
Browse files Browse the repository at this point in the history
  • Loading branch information
grische committed Jun 27, 2024
1 parent cfe5d76 commit 6064eda
Showing 1 changed file with 26 additions and 28 deletions.
54 changes: 26 additions & 28 deletions scripts/check-for-external-updates.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,35 +3,33 @@
set -eEu
set -o pipefail # avoid masking failures in pipes

if [[ -n "$CHECK_EXTERNAL_REPOS" ]];then
changes=0
latest_commits=(
e50e7c959b3ce853635d70585c213fdbf82acee5 # router-pics
4d066b22de7ddf8303faeeafabaa4618d9b0b4be # Freifunk-Router-Anleitungen
c37521feb4f1e71fe5da0863e1810771f96d9529 # freifunk-device-images
0f2479b8dd6ff60b49776464a934a59f32d1e36d # meshviewer-hwimages
)
changes=0
latest_commits=(
e50e7c959b3ce853635d70585c213fdbf82acee5 # router-pics
4d066b22de7ddf8303faeeafabaa4618d9b0b4be # Freifunk-Router-Anleitungen
c37521feb4f1e71fe5da0863e1810771f96d9529 # freifunk-device-images
0f2479b8dd6ff60b49776464a934a59f32d1e36d # meshviewer-hwimages
)

for repo in \
https://github.com/belzebub40k/router-pics.git \
https://github.com/Moorviper/Freifunk-Router-Anleitungen \
https://github.com/nalxnet/freifunk-device-images \
https://github.com/freifunkstuff/meshviewer-hwimages
do
last_commit=$(git ls-remote "${repo}" HEAD | awk '{ print $1}')
if [[ " ${latest_commits[*]} " == *" ${last_commit} "* ]]; then
echo "No changes in repository $repo"
else
echo "Warning: repository $repo has changes!"
changes=$((changes+1))
fi
done

if ((changes > 0)); then
echo "Warning: $changes changes found".
exit 1
for repo in \
https://github.com/belzebub40k/router-pics.git \
https://github.com/Moorviper/Freifunk-Router-Anleitungen \
https://github.com/nalxnet/freifunk-device-images \
https://github.com/freifunkstuff/meshviewer-hwimages
do
last_commit=$(git ls-remote "${repo}" HEAD | awk '{ print $1}')
if [[ " ${latest_commits[*]} " == *" ${last_commit} "* ]]; then
echo "No changes in repository $repo"
else
echo "Warning: repository $repo has changes!"
changes=$((changes+1))
fi
done

echo "No changes found".
exit 0
if ((changes > 0)); then
echo "Warning: $changes changes found".
exit 1
fi

echo "No changes found".
exit 0

0 comments on commit 6064eda

Please sign in to comment.