Skip to content

Commit ecae4de

Browse files
committed
Use dedicated script for detecting component changes in build workflow
1 parent 0379c1b commit ecae4de

File tree

1 file changed

+5
-30
lines changed

1 file changed

+5
-30
lines changed

.github/workflows/build.yml

Lines changed: 5 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -133,24 +133,11 @@ jobs:
133133
with:
134134
vs-version: '[17.9,)'
135135

136-
# Get changed components
137136
- name: Get changed components
138137
run: |
139-
git fetch origin main
140-
git diff --name-only origin/main...${{ github.sha }} -- components/ > ${{ github.workspace }}/changed-files.txt
141-
$otherChanges = git diff --name-only origin/main...${{ github.sha }} | Select-String -NotMatch '^components/'
142-
if (-not $otherChanges) {
143-
$files = Get-Content "${{ github.workspace }}/changed-files.txt"
144-
$names = $files | ForEach-Object { ($_ -replace '^components/', '') -replace '/.*$', '' }
145-
$uniqueNames = $names | Sort-Object -Unique
146-
$quotedNames = $uniqueNames | ForEach-Object { "'$_'" }
147-
$changedComponentsList = $quotedNames -join ','
148-
echo "CHANGED_COMPONENTS_LIST=$changedComponentsList" >> $env:GITHUB_ENV
149-
}
150-
else {
151-
echo "CHANGED_COMPONENTS_LIST='all'" >> $env:GITHUB_ENV
152-
}
153-
138+
$components = ./tooling/Get-Changed-Components.ps1
139+
echo "CHANGED_COMPONENTS_LIST=$components" >> $env:GITHUB_ENV
140+
154141
# Generate full solution with all projects (sample gallery heads, components, tests)
155142
- name: Generate solution with ${{ matrix.multitarget }} gallery, components and tests
156143
working-directory: ./
@@ -280,20 +267,8 @@ jobs:
280267
# Get changed components
281268
- name: Get changed components
282269
run: |
283-
git fetch origin main
284-
git diff --name-only origin/main...${{ github.sha }} -- components/ > ${{ github.workspace }}/changed-files.txt
285-
$otherChanges = git diff --name-only origin/main...${{ github.sha }} | Select-String -NotMatch '^components/'
286-
if (-not $otherChanges) {
287-
$files = Get-Content "${{ github.workspace }}/changed-files.txt"
288-
$names = $files | ForEach-Object { ($_ -replace '^components/', '') -replace '/.*$', '' }
289-
$uniqueNames = $names | Sort-Object -Unique
290-
$quotedNames = $uniqueNames | ForEach-Object { "'$_'" }
291-
$changedComponentsList = $quotedNames -join ','
292-
echo "CHANGED_COMPONENTS_LIST=$changedComponentsList" >> $env:GITHUB_ENV
293-
}
294-
else {
295-
echo "CHANGED_COMPONENTS_LIST='all'" >> $env:GITHUB_ENV
296-
}
270+
$components = ./tooling/Get-Changed-Components.ps1
271+
echo "CHANGED_COMPONENTS_LIST=$components" >> $env:GITHUB_ENV
297272
298273
# Build and pack component nupkg
299274
- name: Build and pack component packages

0 commit comments

Comments
 (0)