diff --git a/dev/flake.nix b/dev/flake.nix index 32564ccf..fa534abf 100644 --- a/dev/flake.nix +++ b/dev/flake.nix @@ -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 ''; };