private static async Task <int> CreateLabelsAsync(LabelSubOptions subOptions) { Log.Information("Creating standard labels"); _vcsProvider = GetVcsProvider(subOptions); await _vcsProvider.CreateLabels(subOptions.RepositoryOwner, subOptions.RepositoryName).ConfigureAwait(false); return(0); }
private static async Task <int> CreateLabelsAsync(LabelSubOptions subOptions) { try { ConfigureLogging(subOptions.LogFilePath); var newLabels = new List <NewLabel>(); newLabels.Add(new NewLabel("Breaking change", "b60205")); newLabels.Add(new NewLabel("Bug", "ee0701")); newLabels.Add(new NewLabel("Build", "009800")); newLabels.Add(new NewLabel("Documentation", "d4c5f9")); newLabels.Add(new NewLabel("Feature", "84b6eb")); newLabels.Add(new NewLabel("Improvement", "207de5")); newLabels.Add(new NewLabel("Question", "cc317c")); newLabels.Add(new NewLabel("good first issue", "7057ff")); newLabels.Add(new NewLabel("help wanted", "33aa3f")); var github = subOptions.CreateGitHubClient(); _configuration = ConfigurationProvider.Provide(subOptions.TargetDirectory ?? Environment.CurrentDirectory, _fileSystem); var labels = await github.Issue.Labels.GetAllForRepository(subOptions.RepositoryOwner, subOptions.RepositoryName); foreach (var label in labels) { await github.Issue.Labels.Delete(subOptions.RepositoryOwner, subOptions.RepositoryName, label.Name); } foreach (var label in newLabels) { await github.Issue.Labels.Create(subOptions.RepositoryOwner, subOptions.RepositoryName, label); } return(0); } catch (Exception ex) { Console.WriteLine(ex); return(1); } }