Format Branch Code #88
This file contains hidden or 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
name: Format Branch Code | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: 0 0 * * * # Every day at midnight (UTC) | |
pull_request: | |
paths: | |
- .github/workflows/dotnet-format-daily.yml | |
permissions: | |
pull-requests: write | |
contents: write | |
jobs: | |
dotnet-format: | |
runs-on: windows-latest | |
strategy: | |
matrix: | |
branch: [ main, net10.0, inflight/current ] | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v2 | |
with: | |
ref: ${{ matrix.branch }} | |
- name: Setup .NET Core SDK | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: 9.x | |
- name: Run a pre-work build | |
shell: pwsh | |
continue-on-error: true | |
run: .\build.ps1 | |
- name: Add the local .NET to the envvars (PATH, DOTNET_ROOT) | |
shell: pwsh | |
run: | | |
Add-Content -Path $env:GITHUB_PATH -Value "$env:GITHUB_WORKSPACE/.dotnet" | |
Add-Content -Path $env:GITHUB_ENV -Value "DOTNET_ROOT=$env:GITHUB_WORKSPACE/.dotnet" | |
Add-Content -Path $env:GITHUB_ENV -Value "DOTNET_INSTALL_DIR=$env:GITHUB_WORKSPACE/.dotnet" | |
- name: Ensure we are using the correct .NET | |
shell: pwsh | |
run: | | |
dotnet --version | |
dotnet --info | |
dotnet workload --info | |
- name: Reset tracked files to clean workspace | |
shell: bash | |
run: | | |
git reset --hard HEAD | |
- name: Run dotnet format | |
run: | | |
dotnet restore Microsoft.Maui.sln | |
dotnet format Microsoft.Maui.sln --exclude Templates/src --exclude-diagnostics CA1822 | |
- name: Create Pull Request | |
uses: dotnet/actions-create-pull-request@v4 | |
with: | |
title: '[housekeeping] Automated PR to fix formatting errors on ${{ matrix.branch }}' | |
body: | | |
Automated PR to fix formatting errors | |
committer: GitHub <[email protected]> | |
author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> | |
labels: | | |
t/housekeeping ♻︎ | |
area-infrastructure | |
assignees: rmarinho, jsuarezruiz, mattleibow | |
reviewers: rmarinho, jsuarezruiz, mattleibow | |
branch: housekeeping/fix-codeformatting/${{ matrix.branch }} | |
base: ${{ matrix.branch }} |