feat(vscode): webhook 副作用按 assignee 门禁,适配多人协作

This commit is contained in:
2026-08-18 23:57:21 +08:00
parent c20bd86370
commit c370214d12
11 changed files with 450 additions and 22 deletions
+15 -1
View File
@@ -81,10 +81,24 @@ func (c *Client) do(method, path string, payload any, out any) error {
return nil
}
// CurrentUserLogin resolves the token owner's login.
func (c *Client) CurrentUserLogin() (string, error) {
var out struct {
Login string `json:"login"`
}
if err := c.do(http.MethodGet, "/api/v1/user", nil, &out); err != nil {
return "", err
}
return out.Login, nil
}
// CreateIssue creates a new issue and returns the created object.
func (c *Client) CreateIssue(owner, repo, title, body string) (*Issue, error) {
func (c *Client) CreateIssue(owner, repo, title, body string, assignees []string) (*Issue, error) {
path := fmt.Sprintf("/api/v1/repos/%s/%s/issues", owner, repo)
payload := map[string]any{"title": title, "body": body}
if len(assignees) > 0 {
payload["assignees"] = assignees
}
var out Issue
if err := c.do(http.MethodPost, path, payload, &out); err != nil {
return nil, err