Skip to content

Commit

Permalink
Fix quoting in GitHubActions for included/excluded paths
Browse files Browse the repository at this point in the history
  • Loading branch information
matkoch committed Apr 22, 2021
1 parent 4e94cc2 commit da8fea7
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/continuous.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ on:
push:
branches-ignore:
- master
- release/*
- 'release/*'
pull_request:
branches:
- develop
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,18 @@ on:
branches:
- push_branch
tags:
- push_tag
- 'push_tag/*'
paths:
- push_include_path
- !push_exclude_path
- '!push_exclude_path'
pull_request:
branches:
- pull_request_branch
tags:
- pull_request_tag
paths:
- pull_request_include_path
- !pull_request_exclude_path
- '!pull_request_exclude_path/**'
workflow_dispatch:
inputs:
OptionalInput:
Expand Down
2 changes: 1 addition & 1 deletion source/Nuke.Common.Tests/CI/ConfigurationGenerationTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ public class TestBuild : NukeBuild
InvokedTargets = new[] { nameof(Test) },
OnCronSchedule = "* 0 * * *",
OnPushBranches = new[] { "push_branch" },
OnPushTags = new[] { "push_tag" },
OnPushTags = new[] { "push_tag/*" },
OnPushIncludePaths = new[] { "push_include_path" },
OnPushExcludePaths = new[] { "push_exclude_path" },
OnPullRequestBranches = new[] { "pull_request_branch" },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,16 @@ public override void Write(CustomFileWriter writer)
{
writer.WriteLine($"{Kind.GetValue()}:");

void WriteValue(string value) => writer.WriteLine($"- {value.SingleQuoteIfNeeded('*', '!')}");

using (writer.Indent())
{
if (Branches.Length > 0)
{
writer.WriteLine("branches:");
using (writer.Indent())
{
Branches.ForEach(x => writer.WriteLine($"- {x}"));
Branches.ForEach(WriteValue);
}
}

Expand All @@ -42,7 +44,7 @@ public override void Write(CustomFileWriter writer)
writer.WriteLine("branches-ignore:");
using (writer.Indent())
{
BranchesIgnore.ForEach(x => writer.WriteLine($"- {x}"));
BranchesIgnore.ForEach(WriteValue);
}
}

Expand All @@ -51,7 +53,7 @@ public override void Write(CustomFileWriter writer)
writer.WriteLine("tags:");
using (writer.Indent())
{
Tags.ForEach(x => writer.WriteLine($"- {x}"));
Tags.ForEach(WriteValue);
}
}

Expand All @@ -60,7 +62,7 @@ public override void Write(CustomFileWriter writer)
writer.WriteLine("tags-ignore:");
using (writer.Indent())
{
TagsIgnore.ForEach(x => writer.WriteLine($"- {x}"));
TagsIgnore.ForEach(WriteValue);
}
}

Expand All @@ -69,8 +71,8 @@ public override void Write(CustomFileWriter writer)
writer.WriteLine("paths:");
using (writer.Indent())
{
IncludePaths.ForEach(x => writer.WriteLine($"- {x}"));
ExcludePaths.ForEach(x => writer.WriteLine($"- !{x}"));
IncludePaths.ForEach(WriteValue);
ExcludePaths.Select(x => $"!{x}").ForEach(WriteValue);
}
}
}
Expand Down

0 comments on commit da8fea7

Please sign in to comment.