Skip to content

Commit dc62829

Browse files
committed
Adding log for branch name etc
1 parent cc62cdb commit dc62829

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

Diff for: .github/workflows/main.yml

+1-3
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,11 @@ jobs:
1414
steps:
1515
- name: Checkout code
1616
uses: actions/checkout@v2
17+
# this is required for the gitversion.tool to be able to work correctly
1718
with:
1819
fetch-depth: 0
1920

2021
- name: Run Script
2122
shell: pwsh
2223
run: |
2324
.\build.ps1 --target=BuildAndTest
24-
25-
- name: checking GitTool version
26-
run: dotnet gitversion --version

Diff for: build/Build/Lifetime.cs

+3-2
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,12 @@ public override void Setup(Context context, ISetupContext info)
2828
catch (Exception ex)
2929
{
3030
context.Error(ex);
31-
3231
// running dev pipeline by default if we can't determine otherwise
3332
context.General.CurrentBranchName = "develop";
3433
context.General.CurrentBranch = new BranchService().GetBranch(context.General.CurrentBranchName);
3534
}
3635

36+
context.Information($"Running pipeline for branch: {context.General.CurrentBranchName}");
3737
context.Information(string.Join(Environment.NewLine, context.Environment.GetEnvironmentVariables()));
3838
}
3939

@@ -42,7 +42,8 @@ public override void Teardown(Context context, ITeardownContext info) =>
4242

4343
private void SetBranchInContext(Context context)
4444
{
45-
//FIXME: git tool is not working on github actions pipeline
45+
// this only works if the fetch-depth on checkout is set to 0 (see main.yml)
46+
// else this tool version will throw an error
4647
GitVersion gitVersion = context.GitVersion(new GitVersionSettings { NoFetch = true });
4748
string branchName = gitVersion.BranchName.ToLower();
4849
context.General.CurrentBranchName = branchName;

0 commit comments

Comments
 (0)