forked from files-community/Files
-
Notifications
You must be signed in to change notification settings - Fork 1
49 lines (44 loc) · 1.11 KB
/
check-xaml-formatting.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
name: Check XAML Formatting
on:
workflow_dispatch:
push:
branches:
- 'main'
- 'service/**'
paths:
- '**.xaml'
pull_request:
branches:
- 'main'
- 'service/**'
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