From eeddcc3433d0f65f8ad4586de23fff2a191ada06 Mon Sep 17 00:00:00 2001 From: Daniel Cazzulino Date: Tue, 29 Oct 2024 15:13:38 -0300 Subject: [PATCH] Allow opting-out of GitBranch default in CI This should allow the old behavior, in case the new defaults disrupt some existing functionality. --- readme.md | 2 ++ src/GitInfo/build/GitInfo.CI.targets | 5 ++++- src/GitInfo/build/GitInfo.targets | 4 +++- src/GitInfo/readme.txt | 2 ++ 4 files changed, 11 insertions(+), 2 deletions(-) diff --git a/readme.md b/readme.md index dbc1e62..3ac5598 100644 --- a/readme.md +++ b/readme.md @@ -205,6 +205,8 @@ to customize the behavior: $(GitRemote): name of remote to get repository url for. Defaults to 'origin'. + $(GitBranchCI): determines whether the branch name should be populated from default environment variables used by the CI system. Default to 'true'. + $(GitDefaultBranch): determines the base branch used to calculate commits on top of current branch. Defaults to 'main'. $(GitVersionFile): determines the name of a file in the Git repository root used to provide the base version info. Defaults to 'GitInfo.txt'. diff --git a/src/GitInfo/build/GitInfo.CI.targets b/src/GitInfo/build/GitInfo.CI.targets index 25ec7c7..5fe6aa7 100644 --- a/src/GitInfo/build/GitInfo.CI.targets +++ b/src/GitInfo/build/GitInfo.CI.targets @@ -1,6 +1,9 @@ - + pr$(GITHUB_REF.Replace('refs/pull/', '').Replace('/merge', '')) diff --git a/src/GitInfo/build/GitInfo.targets b/src/GitInfo/build/GitInfo.targets index 5ffec3a..2b6f4d8 100644 --- a/src/GitInfo/build/GitInfo.targets +++ b/src/GitInfo/build/GitInfo.targets @@ -23,6 +23,8 @@ $(GitDefaultBranch): determines the base branch used to calculate commits on top of current branch. Defaults to 'main'. + $(GitBranchCI): determines whether the branch name should be populated from default environment variables used by the CI system. Default to 'true'. + $(GitVersionFile): determines the name of a file in the Git repository root used to provide the base version info. Defaults to 'GitInfo.txt'. $(GitCommitsRelativeTo): optionally specifies an alternative directory for counting commits on top of the base version. Defaults to the $(GitVersionFile) directory. @@ -116,7 +118,7 @@ '$(BUDDY)' == 'true'">true - +