Skip to content

Commit a4641ff

Browse files
authored
Feature: Add Xaml Styler GitHub Action (#11379)
1 parent d1cfd1e commit a4641ff

File tree

2 files changed

+50
-1
lines changed

2 files changed

+50
-1
lines changed
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: Check XAML Formatting
2+
on:
3+
workflow_dispatch:
4+
push:
5+
branches:
6+
- 'main'
7+
- '**-servicing'
8+
paths:
9+
- '**.xaml'
10+
pull_request:
11+
branches:
12+
- 'main'
13+
- '**-servicing'
14+
paths:
15+
- '**.xaml'
16+
17+
jobs:
18+
check-formatting:
19+
runs-on: ubuntu-latest
20+
defaults:
21+
run:
22+
shell: pwsh
23+
steps:
24+
- uses: actions/checkout@v3
25+
with:
26+
fetch-depth: 2
27+
28+
- name: Install Xaml Styler
29+
run: |
30+
dotnet tool install --global XamlStyler.Console
31+
32+
- name: Check Formatting
33+
id: check-step
34+
run: |
35+
$changedFiles = (git diff --name-only HEAD~1) -split "\n" | Where-Object {$_ -like "*.xaml"}
36+
foreach ($file in $changedFiles)
37+
{
38+
xstyler -p -l None -f $file
39+
if ($LASTEXITCODE -ne 0)
40+
{
41+
echo "::error file=$file::Format check failed"
42+
}
43+
}
44+
continue-on-error: true
45+
46+
- name: Fail job if necessary
47+
if: steps.check-step.outcome == 'failure'
48+
run: exit 1
49+

nuget.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22
<configuration>
33
<packageSources>
44
<add key="NuGet official package source" value="https://api.nuget.org/v3/index.json" />
5-
<add key="Local Packages" value="src\Files.App\nupkgs\" />
5+
<add key="Local Packages" value="src/Files.App/nupkgs/" />
66
</packageSources>
77
</configuration>

0 commit comments

Comments
 (0)