Skip to content

Commit 79dcc9f

Browse files
authored
Fix Copilot Workflow to unshallow Copilot branch (#2124)
1 parent 9767f1e commit 79dcc9f

File tree

5 files changed

+22
-14
lines changed

5 files changed

+22
-14
lines changed

.github/workflows/code-analysis-built-module.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ jobs:
2525
shell: powershell
2626
run: |
2727
dotnet tool install --global GitVersion.Tool --version 5.*
28+
dotnet-gitversion
2829
- name: Run GitVersion
2930
shell: powershell
3031
run: |

.github/workflows/code-analysis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ jobs:
2525
shell: powershell
2626
run: |
2727
dotnet tool install --global GitVersion.Tool --version 5.*
28+
dotnet-gitversion
2829
- name: Run GitVersion
2930
shell: powershell
3031
run: |

.github/workflows/copilot-setup-steps.yml

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,17 @@ jobs:
3636
with:
3737
fetch-depth: 0 # Full history needed for GitVersion
3838

39+
- name: Unshallow repository for GitVersion
40+
if: startsWith(github.ref, 'refs/heads/copilot/')
41+
shell: pwsh
42+
run: |
43+
Write-Host "Unshallow Copilot branch..." -ForegroundColor Green
44+
45+
Write-Host "Removing the depth limit, prune unused refs, and grab tags" -ForegroundColor DarkGray
46+
git fetch --prune --unshallow --tags --no-recurse-submodules
47+
48+
Write-Host "Unshallow complete." -ForegroundColor Green
49+
3950
- name: Configure PowerShell Environment
4051
shell: pwsh
4152
run: |
@@ -71,16 +82,16 @@ jobs:
7182
# Install GitVersion for semantic versioning
7283
dotnet tool install --global GitVersion.Tool --version 5.*
7384
74-
# # Verify installation
75-
# dotnet-gitversion
85+
# Verify installation
86+
dotnet-gitversion
7687
7788
Write-Host ".NET tools installation complete." -ForegroundColor Green
7889
79-
# - name: Verify GitVersion
80-
# shell: pwsh
81-
# run: |
82-
# Write-Host "Running GitVersion to determine semantic version..." -ForegroundColor Green
83-
# dotnet-gitversion | ConvertFrom-Json
90+
- name: Verify GitVersion
91+
shell: pwsh
92+
run: |
93+
Write-Host "Running GitVersion to determine semantic version..." -ForegroundColor Green
94+
dotnet-gitversion | ConvertFrom-Json
8495
8596
- name: Resolve Dependencies
8697
shell: pwsh
@@ -97,11 +108,6 @@ jobs:
97108
run: |
98109
Write-Host "Building SqlServerDsc module..." -ForegroundColor Green
99110
100-
# Hard-code versin due to how Coilot is switching branch (?) so gitversion fails.
101-
$ModuleVersion = '0.0.1'
102-
$env:ModuleVersion = '0.0.1'
103-
[System.Environment]::SetEnvironmentVariable('ModuleVersion','0.0.1', 'Machine')
104-
105111
# Build the module
106112
.\build.ps1 -Tasks 'build' -ErrorAction Stop
107113

CHANGELOG.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
99

1010
- Added setup workflow for GitHub Copilot.
1111
- Switch the workflow to use Linux.
12-
- Skip verify GitVersion after install due to problem with how Copilot switches branch directly after checkout, before setup is finsihed.
13-
- Hardcode module version to 0.0.1 for the build step due to the problem with GitVersion.
12+
- Attempt to unshallow the Copilot branch
1413

1514
### Changed
1615

azure-pipelines.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ stages:
3030
steps:
3131
- pwsh: |
3232
dotnet tool install --global GitVersion.Tool --version 5.*
33+
dotnet-gitversion
3334
$gitVersionObject = dotnet-gitversion | ConvertFrom-Json
3435
$gitVersionObject.PSObject.Properties.ForEach{
3536
Write-Host -Object "Setting Task Variable '$($_.Name)' with value '$($_.Value)'."

0 commit comments

Comments
 (0)