Skip to content

Commit

Permalink
chore: fetch origin
Browse files Browse the repository at this point in the history
  • Loading branch information
shivaraj-bh committed Sep 23, 2024
1 parent 8d4d21a commit 3180b44
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions dev/flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,17 @@
meta.description = "Verify commit messages from the default branch to HEAD follow conventional commit format";
text = ''
default_branch=$(git remote show origin | grep 'HEAD branch' | cut -d' ' -f5)
current_commit=$(git rev-parse HEAD)
commit_count=$(git rev-list --count "$default_branch".."$current_commit")
# github actions does a shallow copy, which will fail when queried on `$default_branch..HEAD`
git fetch origin "$default_branch"
commit_count=$(git rev-list --count "$default_branch"..HEAD)
if [ "$commit_count" -eq 0 ]; then
echo "No commits to check between $default_branch and HEAD."
else
echo "Checking $commit_count commit(s)..."
cz check --rev-range "$default_branch".."$current_commit"
cz check --rev-range "$default_branch"..HEAD
fi
'';
};
Expand Down

0 comments on commit 3180b44

Please sign in to comment.