Merge pull request #3442 from sclu1034/feature/github_actions

Fix "test previous commit" workflow task with only one commit
This commit is contained in:
Emmanuel Lepage Vallée 2021-09-19 22:17:11 -07:00 committed by GitHub
commit d9bfc9c37e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 1 deletions

View File

@ -343,6 +343,12 @@ jobs:
git fetch --unshallow --all git fetch --unshallow --all
rev_list="$(git rev-list --bisect-all origin/${{ github.base_ref }}..fork/${{ github.head_ref }})" rev_list="$(git rev-list --bisect-all origin/${{ github.base_ref }}..fork/${{ github.head_ref }})"
# The most recent commit has already been tested. So if that's the
# only commit in the PR, we can stop here.
if [[ $(echo "$rev_list" | wc -l) -lt 2 ]]; then
exit 0
fi
commits="$(echo "$rev_list" | grep -v 'dist=0' | cut -d' ' -f 1)" commits="$(echo "$rev_list" | grep -v 'dist=0' | cut -d' ' -f 1)"
n="$(echo "$commits" | wc -l)" n="$(echo "$commits" | wc -l)"
@ -374,7 +380,7 @@ jobs:
fi fi
done done
git checkout --quiet --force ${{ github.head_ref }} git checkout --quiet --force fork/${{ github.head_ref }}
if [ -n "$failed" ]; then if [ -n "$failed" ]; then
echo "Checks failed for these commits:" echo "Checks failed for these commits:"