conform icon indicating copy to clipboard operation
conform copied to clipboard

Conform Action fails on PR with: failed to get commit message: object not found

Open janderssonse opened this issue 2 years ago • 2 comments

When running a dco check on a PR, conform enforce fails with "failed to get commit message: object not found".

How to trigger:

  1. Create a sample project on github. In that, include a .conform,yaml ensuring dco: true is set under policies etc.
policies:
  - type: commit
    spec:
      dco: true 
  1. Using the sidero confirm GitHub action, do a commit to main branch (with dco), see the pipeline succeeds and confirm gives success, A simple GitHub action example
  name: Conform DCO (--Sign-off)
  on: ...add on PR etc 
 
  jobs:
   signoff:
     runs-on: ubuntu-latest
     steps:
       - uses: actions/checkout@v3
       - name: Conform Action
         uses: siderolabs/[email protected]
  1. Now, do a git checkout -b feat/my-feat, commit a valid commit. If running local conform enforce, it will succed. Then push to a new branch git push -u origin feat/my-feat etc., and make sure conform was run (on push or whatever you did set it to trigger on). Fails. Merge to main and conform will succed again (on the main branch).

So, it fails on PR to main with: failed to get commit message: object not found

janderssonse avatar Oct 23 '22 15:10 janderssonse

Hello @janderssonse I have setup this action today and ran into this issue. I think this is due to the v3 of the checkout action which does fetched only one commit (see their Readme).

I've managed to get Conform action working by setting this:

      - uses: actions/checkout@v3
        with:
          fetch-depth: 2
      - name: Conform action
        uses: siderolabs/[email protected]
        with:
          token: ${{ secrets.GITHUB_TOKEN }}

Hope it helps.

Mallear avatar Feb 02 '23 10:02 Mallear

It did, thanks!

janderssonse avatar Feb 22 '23 00:02 janderssonse