-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feature: Add Xaml Styler GitHub Action (#11379)
- Loading branch information
1 parent
d1cfd1e
commit a4641ff
Showing
2 changed files
with
50 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
name: Check XAML Formatting | ||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: | ||
- 'main' | ||
- '**-servicing' | ||
paths: | ||
- '**.xaml' | ||
pull_request: | ||
branches: | ||
- 'main' | ||
- '**-servicing' | ||
paths: | ||
- '**.xaml' | ||
|
||
jobs: | ||
check-formatting: | ||
runs-on: ubuntu-latest | ||
defaults: | ||
run: | ||
shell: pwsh | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 2 | ||
|
||
- name: Install Xaml Styler | ||
run: | | ||
dotnet tool install --global XamlStyler.Console | ||
- name: Check Formatting | ||
id: check-step | ||
run: | | ||
$changedFiles = (git diff --name-only HEAD~1) -split "\n" | Where-Object {$_ -like "*.xaml"} | ||
foreach ($file in $changedFiles) | ||
{ | ||
xstyler -p -l None -f $file | ||
if ($LASTEXITCODE -ne 0) | ||
{ | ||
echo "::error file=$file::Format check failed" | ||
} | ||
} | ||
continue-on-error: true | ||
|
||
- name: Fail job if necessary | ||
if: steps.check-step.outcome == 'failure' | ||
run: exit 1 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters