Skip to content

Commit

Permalink
Feature: Add Xaml Styler GitHub Action (#11379)
Browse files Browse the repository at this point in the history
  • Loading branch information
heftymouse authored Apr 3, 2023
1 parent d1cfd1e commit a4641ff
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 1 deletion.
49 changes: 49 additions & 0 deletions .github/workflows/check-xaml-formatting.yml
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

2 changes: 1 addition & 1 deletion nuget.config
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
<configuration>
<packageSources>
<add key="NuGet official package source" value="https://api.nuget.org/v3/index.json" />
<add key="Local Packages" value="src\Files.App\nupkgs\" />
<add key="Local Packages" value="src/Files.App/nupkgs/" />
</packageSources>
</configuration>

0 comments on commit a4641ff

Please sign in to comment.