File tree Expand file tree Collapse file tree 2 files changed +13
-7
lines changed Expand file tree Collapse file tree 2 files changed +13
-7
lines changed Original file line number Diff line number Diff line change 7
7
headers :
8
8
description : " Headers to configure gRPC metadata"
9
9
required : false
10
+ repo-token :
11
+ description : ' The GITHUB_TOKEN secret'
12
+ required : false
10
13
runs :
11
14
using : " docker"
12
15
image : " Dockerfile"
13
16
env :
14
17
OTEL_EXPORTER_OTLP_ENDPOINT : ${{ inputs.endpoint }}
15
18
OTEL_EXPORTER_OTLP_HEADERS : ${{ inputs.headers }}
19
+ GITHUB_TOKEN : ${{ inputs.repo-token }}
Original file line number Diff line number Diff line change @@ -36,17 +36,19 @@ type actionConfig struct {
36
36
37
37
func getSteps (ctx context.Context , conf actionConfig ) error {
38
38
tracer := otel .Tracer (conf .githubRepository )
39
+ client := github .NewClient (nil )
40
+
39
41
// login using the GITHUB_TOKEN coming from the jobs
40
42
// as per https://docs.github.com/en/actions/security-guides/automatic-token-authentication
41
43
githubToken , ok := os .LookupEnv ("GITHUB_TOKEN" )
42
- if ! ok {
43
- return errors .New ("missing variable: GITHUB_TOKEN" )
44
+ if ok {
45
+ ts := oauth2 .StaticTokenSource (
46
+ & oauth2.Token {AccessToken : githubToken },
47
+ )
48
+ tc := oauth2 .NewClient (ctx , ts )
49
+ client = github .NewClient (tc )
44
50
}
45
- ts := oauth2 .StaticTokenSource (
46
- & oauth2.Token {AccessToken : githubToken },
47
- )
48
- tc := oauth2 .NewClient (ctx , ts )
49
- client := github .NewClient (tc )
51
+
50
52
id , err := strconv .ParseInt (conf .runID , 10 , 64 )
51
53
if err != nil {
52
54
return err
You can’t perform that action at this time.
0 commit comments