aevea / commitsar

Tool to check that commits comply with conventional commit standard
https://commitsar.aevea.ee
MIT License
136 stars 19 forks source link

commitsar fails on shallow clone #420

Open vikas027 opened 3 years ago

vikas027 commented 3 years ago

Environmentent

I have downloaded commitsar executable on my custom action runner (running Ubuntu) and using it as below

    steps:
    - name: Checkout
      uses: actions/checkout@v2  # I have tried actions/checkout@v1 too

    - name: Validate Commits
      run: commitsar -v 

Problem

commitsar fails on a shallow clone

runner@runner-deployment-nzvgd-6kpsc:/runner/_work/.github/.github$ git log      
commit 048c926b55b5386bdc0cb4d0f0919a993afc46b3 (grafted, HEAD)
Author: Vikas Kumar <vikas@reachvikas.com>
Date:   Fri Sep 17 01:24:33 2021 +1000

    docs:  updated README

    Fixed the repository name in README
runner@runner-deployment-nzvgd-6kpsc:/runner/_work/.github/.github$

runner@runner-deployment-nzvgd-6kpsc:/runner/_work/.github/.github$ git branch -a
* (HEAD detached at 048c926)
runner@runner-deployment-nzvgd-6kpsc:/runner/_work/.github/.github$ 

runner@runner-deployment-nzvgd-6kpsc:/runner/_work/.github/.github$ commitsar -v
2021/09/16 15:56:51 config file not found, using defaults
   • Starting pipeline: commit-pipeline
   • Starting analysis of commits on branch HEAD
   • All pipelines complete   
   • [commit-pipeline] reference not found
Some errors were found
runner@runner-deployment-nzvgd-6kpsc:/runner/_work/.github/.github$ 

Workaround

    - name: Checkout
      uses: actions/checkout@v2
      with:
        fetch-depth: 0

or

    - name: Validate Commits
      run: |
        git fetch --unshallow
        commitsar -v 
fallion commented 3 years ago

I’m going to see if we can use git instead to get data from a shallow clone. The current lib that is used fails on shallow objects :(