mirror of
https://github.com/mudler/LocalAI.git
synced 2024-12-24 23:06:42 +00:00
c8fc92d6d5
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
22 lines
592 B
Bash
Executable File
22 lines
592 B
Bash
Executable File
#!/bin/bash
|
|
set -xe
|
|
REPO=$1
|
|
BRANCH=$2
|
|
VAR=$3
|
|
|
|
LAST_COMMIT=$(curl -s -H "Accept: application/vnd.github.VERSION.sha" "https://api.github.com/repos/$REPO/commits/$BRANCH")
|
|
|
|
# Read $VAR from Makefile (only first match)
|
|
set +e
|
|
CURRENT_COMMIT="$(grep -m1 "^$VAR?=" Makefile | cut -d'=' -f2)"
|
|
set -e
|
|
|
|
sed -i Makefile -e "s/$VAR?=.*/$VAR?=$LAST_COMMIT/"
|
|
|
|
if [ -z "$CURRENT_COMMIT" ]; then
|
|
echo "Could not find $VAR in Makefile."
|
|
exit 0
|
|
fi
|
|
|
|
echo "Changes: https://github.com/$REPO/compare/${CURRENT_COMMIT}..${LAST_COMMIT}" >> "${VAR}_message.txt"
|
|
echo "${LAST_COMMIT}" >> "${VAR}_commit.txt" |