-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add github app #1070
feat: add github app #1070
Changes from 31 commits
74626c9
974c8e6
2f2c425
528291a
b53c687
4734dcb
1fb52df
e996aa6
c299ee4
c8da9e3
1ee254f
8dd6033
0eb92b1
d5dcb6d
be8dd9a
73893b5
355017b
3e17278
d3c1e06
d63abfe
a353552
f1a8ab6
c23c599
f0a145d
00e13f2
ccab2bf
f4456e5
8c14e0f
6de5bcc
7b89f5b
b011b7c
d4efd6b
8dec758
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -447,7 +447,7 @@ | |
// loop to capture *ALL* the repos | ||
for { | ||
// send API call to capture the user's repos | ||
repos, resp, err := client.Repositories.List(ctx, "", opts) | ||
Check failure on line 450 in scm/github/repo.go GitHub Actions / golangci[golangci] scm/github/repo.go#L450
Raw output
|
||
if err != nil { | ||
return nil, fmt.Errorf("unable to list user repos: %w", err) | ||
} | ||
|
@@ -585,3 +585,42 @@ | |
|
||
return data.GetName(), data.GetCommit().GetSHA(), nil | ||
} | ||
|
||
// CreateChecks defines a function that does stuff... | ||
func (c *client) CreateChecks(ctx context.Context, r *library.Repo, s *library.Step, branch string) (int64, error) { | ||
// create client from GitHub App | ||
client := c.newGithubAppToken(r) | ||
Check failure on line 592 in scm/github/repo.go GitHub Actions / golangci[golangci] scm/github/repo.go#L592
Raw output
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🚫 [golangci] reported by reviewdog 🐶 |
||
|
||
opts := github.CreateCheckRunOptions{ | ||
// TODO: add step name? | ||
Name: fmt.Sprintf("vela-%s-%s", branch, s.GetName()), | ||
HeadSHA: branch, | ||
} | ||
|
||
check, _, err := client.Checks.CreateCheckRun(ctx, r.GetOrg(), r.GetName(), opts) | ||
if err != nil { | ||
return 0, err | ||
} | ||
|
||
return check.GetID(), nil | ||
} | ||
|
||
// UpdateChecks defines a function that does stuff... | ||
func (c *client) UpdateChecks(ctx context.Context, r *library.Repo, s *library.Step, id int64, branch string) error { | ||
// create client from GitHub App | ||
client := c.newGithubAppToken(r) | ||
Check failure on line 611 in scm/github/repo.go GitHub Actions / golangci[golangci] scm/github/repo.go#L611
Raw output
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🚫 [golangci] reported by reviewdog 🐶 |
||
|
||
opts := github.UpdateCheckRunOptions{ | ||
// TODO: add step name? | ||
Name: fmt.Sprintf("vela-%s-%s", branch, s.GetName()), | ||
Status: github.String("completed"), | ||
Conclusion: github.String("success"), | ||
} | ||
|
||
_, _, err := client.Checks.UpdateCheckRun(ctx, r.GetOrg(), r.GetName(), id, opts) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
return nil | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [golangci] reported by reviewdog 🐶
func
(*client).newGithubAppToken
is unused (unused)