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 77 headers :
88 description : " Headers to configure gRPC metadata"
99 required : false
10+ repo-token :
11+ description : ' The GITHUB_TOKEN secret'
12+ required : false
1013runs :
1114 using : " docker"
1215 image : " Dockerfile"
1316 env :
1417 OTEL_EXPORTER_OTLP_ENDPOINT : ${{ inputs.endpoint }}
1518 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 {
3636
3737func getSteps (ctx context.Context , conf actionConfig ) error {
3838 tracer := otel .Tracer (conf .githubRepository )
39+ client := github .NewClient (nil )
40+
3941 // login using the GITHUB_TOKEN coming from the jobs
4042 // as per https://docs.github.com/en/actions/security-guides/automatic-token-authentication
4143 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 )
4450 }
45- ts := oauth2 .StaticTokenSource (
46- & oauth2.Token {AccessToken : githubToken },
47- )
48- tc := oauth2 .NewClient (ctx , ts )
49- client := github .NewClient (tc )
51+
5052 id , err := strconv .ParseInt (conf .runID , 10 , 64 )
5153 if err != nil {
5254 return err
You can’t perform that action at this time.
0 commit comments