Skip to content

Commit

Permalink
Use GitHubActions which is injected on build
Browse files Browse the repository at this point in the history
  • Loading branch information
IT-VBFK committed Jan 10, 2023
1 parent 7e491af commit 232822d
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions Build/Build.cs
Expand Up @@ -54,14 +54,16 @@ class Build : NukeBuild

public static int Main() => Execute<Build>(x => x.SpellCheck, x => x.Push);

GitHubActions GitHubActions => GitHubActions.Instance;

[Parameter("A branch specification such as develop or refs/pull/1775/merge")]
readonly string BranchSpec;
string BranchSpec => GitHubActions?.Ref;

[Parameter("An incrementing build number as provided by the build engine")]
readonly string BuildNumber;
string BuildNumber => GitHubActions?.RunNumber.ToString();

[Parameter("The target branch for the pull request")]
readonly string PullRequestBase;
string PullRequestBase => GitHubActions?.BaseRef;

[Parameter("The key to push to Nuget")]
[Secret]
Expand Down Expand Up @@ -102,6 +104,9 @@ class Build : NukeBuild
.OnlyWhenDynamic(() => RunAllTargets || HasSourceChanges)
.Executes(() =>
{
Information(BranchSpec);
Information(BuildNumber);
Information(PullRequestBase);
EnsureCleanDirectory(ArtifactsDirectory);
EnsureCleanDirectory(TestResultsDirectory);
});
Expand Down

0 comments on commit 232822d

Please sign in to comment.