@@ -17,8 +17,10 @@ package server
17
17
import (
18
18
"context"
19
19
"io"
20
+ "net/http"
20
21
"os"
21
22
23
+ "github.com/google/go-github/v42/github"
22
24
. "github.com/onsi/ginkgo/v2"
23
25
. "github.com/onsi/gomega"
24
26
@@ -112,3 +114,36 @@ var _ = Describe("E2E Test: getAndVerifyWorkflowContent", func() {
112
114
AssertInvalidWorkflowContent ("testdata/results/imposter-commit-results.json" , "imposter commit" )
113
115
})
114
116
})
117
+
118
+ // helper function to setup a github verifier with an appropriately set token.
119
+ func getGithubVerifier () githubVerifier {
120
+ httpClient := http .DefaultClient
121
+ token , _ := readGitHubTokens ()
122
+ if token != "" {
123
+ httpClient .Transport = githubTransport {
124
+ token : token ,
125
+ }
126
+ }
127
+ return githubVerifier {
128
+ ctx : context .Background (),
129
+ client : github .NewClient (httpClient ),
130
+ }
131
+ }
132
+
133
+ var _ = Describe ("E2E Test: githubVerifier_contains" , func () {
134
+ Context ("E2E Test: Validate known good commits" , func () {
135
+ It ("can detect actions/upload-artifact v3-node20 commits" , func () {
136
+ gv := getGithubVerifier ()
137
+ c , err := gv .contains ("actions" , "upload-artifact" , "97a0fba1372883ab732affbe8f94b823f91727db" )
138
+ Expect (err ).Should (BeNil ())
139
+ Expect (c ).To (BeTrue ())
140
+ })
141
+
142
+ It ("can detect github/codeql-action backport commits" , func () {
143
+ gv := getGithubVerifier ()
144
+ c , err := gv .contains ("github" , "codeql-action" , "a82bad71823183e5b120ab52d521460ecb0585fe" )
145
+ Expect (err ).Should (BeNil ())
146
+ Expect (c ).To (BeTrue ())
147
+ })
148
+ })
149
+ })
0 commit comments