2023-05-04 13:01:29 +00:00
|
|
|
#!/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")
|
|
|
|
|
2024-08-06 07:04:57 +00:00
|
|
|
# Read $VAR from Makefile (only first match)
|
|
|
|
set +e
|
|
|
|
CURRENT_COMMIT="$(grep -m1 "^$VAR?=" Makefile | cut -d'=' -f2)"
|
|
|
|
set -e
|
|
|
|
|
2023-05-04 13:01:29 +00:00
|
|
|
sed -i Makefile -e "s/$VAR?=.*/$VAR?=$LAST_COMMIT/"
|
2024-08-06 07:04:57 +00:00
|
|
|
|
|
|
|
if [ -z "$CURRENT_COMMIT" ]; then
|
|
|
|
echo "Could not find $VAR in Makefile."
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
2024-08-06 07:16:17 +00:00
|
|
|
echo "Changes: https://github.com/$REPO/compare/${CURRENT_COMMIT}..${LAST_COMMIT}" >> "${VAR}_message.txt"
|
2024-08-06 07:12:10 +00:00
|
|
|
echo "${LAST_COMMIT}" >> "${VAR}_commit.txt"
|