forked from nuke-build/nuke
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGitHubActionsCheckoutStep.cs
46 lines (41 loc) · 1.64 KB
/
GitHubActionsCheckoutStep.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
// Copyright 2023 Maintainers of NUKE.
// Distributed under the MIT License.
// https://github.com/nuke-build/nuke/blob/master/LICENSE
using System;
using System.Linq;
using JetBrains.Annotations;
using Nuke.Common.Utilities;
namespace Nuke.Common.CI.GitHubActions.Configuration;
[PublicAPI]
public class GitHubActionsCheckoutStep : GitHubActionsStep
{
public GitHubActionsSubmodules? Submodules { get; set; }
public bool? Lfs { get; set; }
public uint? FetchDepth { get; set; }
public bool? Progress { get; set; }
public string Filter { get; set; }
public override void Write(CustomFileWriter writer)
{
writer.WriteLine("- uses: actions/checkout@v4");
if (Submodules.HasValue || Lfs.HasValue || FetchDepth.HasValue || Progress.HasValue || !Filter.IsNullOrWhiteSpace())
{
using (writer.Indent())
{
writer.WriteLine("with:");
using (writer.Indent())
{
if (Submodules.HasValue)
writer.WriteLine($"submodules: {Submodules.ToString().ToLowerInvariant()}");
if(Lfs.HasValue)
writer.WriteLine($"lfs: {Lfs.ToString().ToLowerInvariant()}");
if (FetchDepth.HasValue)
writer.WriteLine($"fetch-depth: {FetchDepth}");
if (Progress.HasValue)
writer.WriteLine($"progress: {Progress.ToString().ToLowerInvariant()}");
if (!Filter.IsNullOrWhiteSpace())
writer.WriteLine($"filter: {Filter}");
}
}
}
}
}