This repository has been archived by the owner on Feb 23, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathtypes.go
86 lines (78 loc) · 2.96 KB
/
types.go
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
/*
* Copyright © 2022 Atomist, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package main
import (
"github.com/atomist-skills/go-skill"
"olympos.io/encoding/edn"
)
// OnCommit maps the incoming commit of the on_push and on_commit_signature to a Go struct
type OnCommit struct {
Sha string `edn:"git.commit/sha"`
Message string `edn:"git.commit/message"`
Author struct {
Name string `edn:"git.user/name"`
Login string `edn:"git.user/login"`
} `edn:"git.commit/author"`
Repo struct {
Name string `edn:"git.repo/name"`
DefaultBranch string `edn:"git.repo/default-branch"`
Org struct {
Name string `edn:"git.org/name"`
InstallationToken string `edn:"github.org/installation-token"`
Url string `edn:"git.provider/url"`
} `edn:"git.repo/org"`
SourceId string `edn:"git.repo/source-id"`
} `edn:"git.commit/repo"`
Refs []struct {
Name string `edn:"git.ref/name"`
Type struct {
Ident edn.Keyword `edn:"db/ident"`
} `edn:"git.ref/type"`
} `edn:"git.ref/refs"`
}
// OnCommitSignature maps the incoming commit signature of the on_commit_signature to a Go struct
type OnCommitSignature struct {
Signature string `edn:"git.commit.signature/signature"`
Reason string `edn:"git.commit.signature/reason"`
Status struct {
Ident edn.Keyword `edn:"db/ident"`
} `edn:"git.commit.signature/status"`
}
// GitRepoEntity provides mappings for a :git/repo entity
type GitRepoEntity struct {
skill.Entity `entity-type:"git/repo"`
SourceId string `edn:"git.repo/source-id"`
Url string `edn:"git.provider/url"`
}
// GitCommitEntity provides mappings for a :git/commit entity
type GitCommitEntity struct {
skill.Entity `entity-type:"git/commit"`
Sha string `edn:"git.commit/sha"`
Repo GitRepoEntity `edn:"git.commit/repo"`
Url string `edn:"git.provider/url"`
}
// GitCommitSignatureEntity provides mappings for a :git.commit/signature entity
type GitCommitSignatureEntity struct {
skill.Entity `entity-type:"git.commit/signature"`
Commit GitCommitEntity `edn:"git.commit.signature/commit"`
Signature string `edn:"git.commit.signature/signature,omitempty"`
Reason string `edn:"git.commit.signature/reason,omitempty"`
Status edn.Keyword `edn:"git.commit.signature/status,omitempty"`
}
const (
Verified edn.Keyword = "git.commit.signature/VERIFIED"
NotVerified edn.Keyword = "git.commit.signature/NOT_VERIFIED"
)