Skip to content

Commit 4924d5b

Browse files
committed
[ci] Fail build if any git tracked files were modified.
1 parent ee47652 commit 4924d5b

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

build-tools/automation/azure-pipelines.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ jobs:
6161
nativeAotRid: win-x64
6262
platformName: .NET - Windows
6363

64+
- template: templates\fail-on-dirty-tree.yaml
65+
6466
- template: templates\fail-on-issue.yaml
6567

6668
- task: PublishPipelineArtifact@1
@@ -92,6 +94,8 @@ jobs:
9294
nativeAotRid: osx-x64
9395
platformName: .NET - MacOS
9496

97+
- template: templates\fail-on-dirty-tree.yaml
98+
9599
- template: templates\fail-on-issue.yaml
96100

97101

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Ensure the build did not produce any modified checked in files
2+
3+
parameters:
4+
condition: succeeded()
5+
6+
steps:
7+
- powershell: |
8+
# Run this to log the output for the user
9+
git status
10+
11+
# Run this to error the build if untracked files
12+
$process= git status --porcelain --untracked-files=no
13+
14+
if ($process)
15+
{
16+
Write-Host "##vso[task.logissue type=error]git tree has modified tracked files."
17+
Write-Host "##vso[task.complete result=Failed;]"
18+
}
19+
displayName: Ensure no modified committed files
20+
condition: ${{ parameters.condition }}

0 commit comments

Comments
 (0)