示例#1
0
        public async Task PostAsync([FromBody]IssueEventPayload data)
        {
            GitHubIssue issue = data.Issue;
            List<object> labels = issue.Labels;

            if (data.Action == "opened" && labels.Count == 0)
            {
                string title = issue.Title;
                int number = issue.Number;
                string body = issue.Description;

                await Issuelabeler.PredictAndApplyLabelAsync(number, title, body, Logger);
                Logger.LogInformation("! Labeling completed");
            }
            else
            {
                Logger.LogInformation($"! The issue {issue.Number.ToString()} is already opened or it already has a label");
            }
        }
示例#2
0
        public async Task PostAsync([FromBody] IssueEventPayload data)
        {
            GitHubIssue      issueOrPullRequest = data.Issue ?? data.Pull_Request;
            GithubObjectType issueOrPr          = data.Issue == null ? GithubObjectType.PullRequest : GithubObjectType.Issue;

            if (data.Action == "opened" && issueOrPullRequest.Labels.Count == 0)
            {
                string title  = issueOrPullRequest.Title;
                int    number = issueOrPullRequest.Number;
                string body   = issueOrPullRequest.Body;

                await Issuelabeler.PredictAndApplyLabelAsync(number, title, body, issueOrPr, Logger);

                Logger.LogInformation("! Labeling completed");
            }
            else
            {
                Logger.LogInformation($"! The {issueOrPr} {issueOrPullRequest.Number} is already opened or it already has a label");
            }
        }