• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

mindersec / minder / 24481154401

15 Apr 2026 10:14PM UTC coverage: 59.416% (-0.1%) from 59.539%
24481154401

Pull #6380

github

web-flow
Merge ed95b536b into d547963f7
Pull Request #6380: feat(engine): expose structured commit metadata for pull request evaluation

6 of 81 new or added lines in 3 files covered. (7.41%)

19956 of 33587 relevant lines covered (59.42%)

35.92 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/internal/engine/commitinfo/commitinfo.go
1
// SPDX-FileCopyrightText: Copyright 2023 The Minder Authors
2
// SPDX-License-Identifier: Apache-2.0
3

4
// Package commitinfo provides utilities for extracting and normalizing
5
// pull request commit metadata into a provider-agnostic structure.
6
//
7
// It is designed to decouple commit data handling from provider-specific
8
// implementations (e.g., GitHub) and avoid import cycles between engine
9
// components.
10
package commitinfo
11

12
import (
13
        "strings"
14

15
        "github.com/google/go-github/v63/github"
16
)
17

18
// CommitInfo represents normalized pull request commit metadata.
19
type CommitInfo struct {
20
        SHA     string
21
        Message string
22
        Author  string
23
}
24

25
// Extract normalizes a GitHub commit into a CommitInfo struct.
NEW
26
func Extract(c *github.RepositoryCommit) CommitInfo {
×
NEW
27
        msg := ""
×
NEW
28
        if c.GetCommit() != nil {
×
NEW
29
                msg = c.GetCommit().GetMessage()
×
NEW
30
        }
×
31

NEW
32
        firstLine := msg
×
NEW
33
        if idx := strings.Index(msg, "\n"); idx != -1 {
×
NEW
34
                firstLine = msg[:idx]
×
NEW
35
        }
×
NEW
36
        firstLine = strings.TrimSpace(firstLine)
×
NEW
37

×
NEW
38
        author := ""
×
NEW
39
        if c.GetCommit() != nil && c.GetCommit().Author != nil {
×
NEW
40
                author = c.GetCommit().Author.GetName()
×
NEW
41
        }
×
42

NEW
43
        return CommitInfo{
×
NEW
44
                SHA:     c.GetSHA(),
×
NEW
45
                Message: firstLine,
×
NEW
46
                Author:  author,
×
NEW
47
        }
×
48
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc