siderolabs / conform

Policy enforcement for your pipelines.
Mozilla Public License 2.0
432 stars 45 forks source link

"reference not found" for maximumOfOneCommit option in GitHub Actions #161

Closed particledecay closed 4 years ago

particledecay commented 4 years ago

Exactly what my super-wordy title says. I have a GitHub action running in one of my template repos, and after squashing and merging my already-rebased single-commit PR, the action seems to fail with the following:

POLICY        CHECK                      STATUS        MESSAGE                    
commit        Header Length              PASS          <none>                     
2020/04/10 04:42:58 1 or more policy failed
commit        Imperative Mood            PASS          <none>                     
commit        Conventional Commit        PASS          <none>                     
commit        Number of Commits          FAILED        reference not found        
github.com/talos-systems/conform/internal/enforcer.(*Conform).Enforce
    /conform/internal/enforcer/enforcer.go:107
github.com/talos-systems/conform/cmd.glob..func1
    /conform/cmd/enforce.go:40
github.com/spf13/cobra.(*Command).execute
    /go/pkg/mod/github.com/spf13/cobra@v0.0.3/command.go:766
github.com/spf13/cobra.(*Command).ExecuteC
    /go/pkg/mod/github.com/spf13/cobra@v0.0.3/command.go:852
github.com/spf13/cobra.(*Command).Execute
    /go/pkg/mod/github.com/spf13/cobra@v0.0.3/command.go:800
github.com/talos-systems/conform/cmd.Execute
    /conform/cmd/root.go:24
main.main
    /conform/main.go:10
runtime.main
    /usr/local/go/src/runtime/proc.go:200
runtime.goexit
    /usr/local/go/src/runtime/asm_amd64.s:1337
andrewrynhard commented 4 years ago

@particledecay Can you verify that .git/refs/heads/master exists? I'm looking at https://github.com/talos-systems/conform/blob/master/internal/policy/commit/commit.go#L111.

andrewrynhard commented 4 years ago

@particledecay As we discussed, this is a limitation in the way GH actions checks out a repo. Gonna close.

particledecay commented 4 years ago

Yep. The problem is in the actions/checkout action only grabbing a single commit and not having the rest of the references available to make the comparison.