示例#1
0
        private static TypeScope?GetMatchingTypeScop(ConventionalCommitInfo commit, HashSet <TypeScope> types)
        {
            var typeConfig      = types.FirstOrDefault(t => string.Equals(t.Type, commit.CommitType, StringComparison.OrdinalIgnoreCase));
            var typeScopeConfig = types.FirstOrDefault(t => string.Equals(t.Type, commit.CommitType, StringComparison.OrdinalIgnoreCase) &&
                                                       string.Equals(t.Scope, commit.CommitScope, StringComparison.OrdinalIgnoreCase));

            return(typeScopeConfig ?? typeConfig);
        }
示例#2
0
        public void ParseReleaseNotes(ReleaseNotesData releaseNotes, ConventionalCommitInfo commit)
        {
            var typeScope = GetMatchingTypeScop(commit, this.types);

            Description?title;

            if (typeScope != null && (typeScope.IncludeInChangelog || commit.IsBreakingChange))
            {
                title = typeScope.Description;
            }
            else
            {
                this.writer.AddIndent();
                this.writer.WriteInfoLine("[dim]:white_exclamation_mark: Not a commit to include in the changelog.[/]");
                this.writer.RemoveIndent();
                return;
            }

            var note = new NoteData(commit.CommitType, commit.Message, commit.CommitScope ?? string.Empty);

            note.Issues.AddRange(commit.IssueRefs);

            if (commit.IsBreakingChange)
            {
                if (!string.IsNullOrEmpty(commit.BreakingChangeNote))
                {
                    releaseNotes.BreakingChanges.Add(commit.BreakingChangeNote);
                }
                else
                {
                    title = new Description("BREAKING CHANGE", "BREAKING CHANGES");
                }
            }

            var currentNotes = UpdateOrAddNote(releaseNotes, title);

            currentNotes.Add(note);

            this.writer.AddIndent();

            this.writer.WriteInfoLine(":check_mark_button: [teal]A new [fuchsia on black]{0}[/] was found. Adding to changelog![/]", title.Singular);

            this.writer.RemoveIndent();
        }
示例#3
0
        private static string AddResolvedIssues(ConventionalCommitInfo newCommit, string line)
        {
            var closeKeywords = new[]
            {
                "close #",
                "closes #",
                "closed #",
                "fix #",
                "fixes #",
                "fixed #",
                "resolve #",
                "resolves #",
                "resolved #"
            };

            var    subs = line;
            string found;

            while ((found = Array.Find(closeKeywords, c => subs.StartsWith(c, StringComparison.OrdinalIgnoreCase))) != null)
            {
                var tempSub = subs[found.Length..];