Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .fallout/build.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,16 @@
"type": "string",
"default": "Secrets must be entered via 'fallout :secrets [profile]'"
},
"NuGetSource": {
"type": "string"
},
"PublishTo": {
"type": "array",
"description": "Publish only to these named targets (default: all configured PublishTargets)",
"items": {
"type": "string"
}
},
"Solution": {
"type": "string",
"description": "Path to a solution file that is automatically loaded"
Expand Down
8 changes: 5 additions & 3 deletions src/Fallout.Common/ChangeLog/ChangeLogTasks.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,21 +21,23 @@ public static class ChangelogTasks
{
public static string GetNuGetReleaseNotes(string changelogFile, GitRepository repository = null)
{
AbsolutePath changelogPath = changelogFile;

// URL-encode characters MSBuild treats as command-line/property metacharacters.
// Without this, MSBuild's property parser splits on ; (turning a long release note
// into multiple bogus arguments) and chokes on stray " in the value.
var changelogSectionNotes = ExtractChangelogSectionNotes(changelogFile)
var changelogSectionNotes = ExtractChangelogSectionNotes(changelogPath)
.Select(x => x.Replace("- ", "\u2022 ")
.Replace("* ", "\u2022 ")
.Replace("+ ", "\u2022 ")
.Replace("`", string.Empty)
.Replace(",", "%2C")
.Replace(";", "%3B")).ToList();

if (repository.IsGitHubRepository())
if (repository.IsGitHubRepository() && changelogPath.FileExists())
{
changelogSectionNotes.Add(string.Empty);
changelogSectionNotes.Add($"Full changelog at {repository.GetGitHubBrowseUrl(changelogFile)}");
changelogSectionNotes.Add($"Full changelog at {repository.GetGitHubBrowseUrl(changelogPath, itemType: GitHubItemType.File)}");
}

return changelogSectionNotes.JoinNewLine();
Expand Down
16 changes: 16 additions & 0 deletions tests/Fallout.Common.Tests/ChangelogTasksTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
using System.Threading.Tasks;
using FluentAssertions;
using Fallout.Common.ChangeLog;
using Fallout.Common.Git;
using Fallout.Common.IO;
using Fallout.Common.Tools.GitHub;
using VerifyXunit;
using Xunit;

Expand Down Expand Up @@ -38,6 +40,20 @@ public void Extracting_a_changelog_from_a_non_existing_file_returns_an_empty_col
ChangelogTasks.ExtractChangelogSectionNotes(file).Should().BeEmpty();
}

[Fact]
public void Missing_changelog_does_not_add_a_full_changelog_link_to_release_notes()
{
// Arrange
var changelogFile = RootDirectory / "does-not-exist.md";
var repository = GitRepository.FromLocalDirectory(RootDirectory);

// Act
string releaseNotes = ChangelogTasks.GetNuGetReleaseNotes(changelogFile, repository);

// Assert
releaseNotes.Should().BeEmpty();
}

[Fact]
public void GetReleaseSections_ChangelogReferenceFileWithoutReleaseHead_ReturnsEmpty()
{
Expand Down
Loading