'if the last 20 commit numbers are not in the current branch, the build(bitbucket pipeline) should fail
if the last 20 commit numbers are not in the current branch, the transaction should fail my sh script.
#!/bin/sh
masterCommit=$(git rev-list -n 20 master)
currentBranch=$(git rev-parse --abbrev-ref HEAD)
currentCommit=$(git rev-list -n 100 "${currentBranch}")
echo "Current branch: ${currentBranch}"
echo "Current commit: ${currentCommit}"
echo "Master commit: ${masterCommit}"
for i in $masterCommit; do
for j in $currentCommit; do
if [ "$i" != "$j" ]; then
echo "BUİLD FAİl: $i"
exit 0
fi
done
done
but it didn't. How can I do it I have to throw the commit numbers into an array and say it failed if it is not in it.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
