2021-02-25 11:02:08 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
2023-03-23 10:23:58 +00:00
|
|
|
source "./scripts/functions.sh"
|
2023-03-16 10:52:28 +00:00
|
|
|
|
2022-07-05 14:07:15 +00:00
|
|
|
function get_behat_plugin_changes_diff {
|
2022-07-07 11:33:27 +00:00
|
|
|
# Grab hashes from app repository
|
2022-07-05 14:07:15 +00:00
|
|
|
currenthash=`git rev-parse HEAD`
|
|
|
|
initialhash=`git rev-list HEAD | tail -n 1`
|
2022-07-07 11:33:27 +00:00
|
|
|
|
|
|
|
# Move into plugin repository to find previous hash
|
|
|
|
cd tmp/local_moodleappbehat
|
|
|
|
|
|
|
|
i=0
|
|
|
|
previoushash=""
|
2022-07-05 14:07:15 +00:00
|
|
|
totalcommits=`git log --oneline | wc -l`
|
|
|
|
repositoryname=`echo $GITHUB_REPOSITORY | sed "s/\\//\\\\\\\\\\//"`
|
|
|
|
|
|
|
|
((totalcommits--))
|
|
|
|
while [ $i -lt $totalcommits ] && [[ -z $previoushash ]]; do
|
|
|
|
previoushash=`git rev-list --format=%B --max-count=1 HEAD~$i | grep -o "https:\/\/github\.com\/$repositoryname\/compare\/[^.]\+\.\.\.[^.]\+" | sed "s/https:\/\/github\.com\/$repositoryname\/compare\/[^.]\+\.\.\.//"`
|
|
|
|
((i++))
|
|
|
|
done
|
|
|
|
|
|
|
|
if [[ -z $previoushash ]]; then
|
|
|
|
previoushash=$initialhash
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo "$previoushash...$currenthash"
|
|
|
|
}
|