-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrequest.go
More file actions
54 lines (47 loc) · 1.13 KB
/
request.go
File metadata and controls
54 lines (47 loc) · 1.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
package main
import (
"fmt"
"strings"
)
type diffRange struct {
BaseSHA string
HeadSHA string
}
type runRequest struct {
RepoRoot string
Range diffRange
Fetches []fetchSpec
MergeBaseRef string
Sinks outputSinks
Plan planOptions
}
type fetchSpec struct {
Remote string
Ref string
}
type outputSinks struct {
OutMatrix string
OutSummary string
GitHubOutput string
GitHubStepSummary string
}
// validateRevisionArg rejects git revision strings that would be unsafe to pass
// as a single argv element. It is not a SHA-format validator.
func validateRevisionArg(name, revision string) error {
if revision == "" {
return fmt.Errorf("%s is required", name)
}
if strings.HasPrefix(revision, "-") {
return fmt.Errorf("%s must not start with '-': %q", name, revision)
}
if strings.Contains(revision, ":") {
return fmt.Errorf("%s must not contain ':': %q", name, revision)
}
if strings.ContainsRune(revision, '\x00') {
return fmt.Errorf("%s must not contain NUL bytes", name)
}
return nil
}
func diffRangeSpec(cfg config) string {
return cfg.BaseSHA + "..." + cfg.HeadSHA
}