Skip to content

.NET 8.0 dotnet-format #5

.NET 8.0 dotnet-format

.NET 8.0 dotnet-format #5

# https://learn.microsoft.com/en-us/dotnet/core/tools/dotnet-format
name: .NET 8.0 dotnet-format
on:
push:
branches:
- main
paths:
- 'dotnet/net8.0/**'
workflow_dispatch:
env:
DOTNET_FORMAT_VERBOSITY: diag
BRANCH: dotnet-format-${{ github.run_id }}
permissions:
contents: write
pull-requests: write
jobs:
run-dotnet-format:
runs-on: ubuntu-latest
defaults:
run:
working-directory: 'dotnet/net8.0'
outputs:
branch-name: ${{ steps.commit-step.outputs.branch-name }}
steps:
- uses: actions/checkout@v3
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: '8.0.x'
dotnet-quality: 'preview'
- name: Format on branch
id: commit-step
run: |
dotnet format consoleapp/consoleapp.csproj --no-restore --verbosity $DOTNET_FORMAT_VERBOSITY
# dotnet format razorpageapp/razorpageapp.csproj --no-restore --verbosity $DOTNET_FORMAT_VERBOSITY
git checkout -b $BRANCH
git config user.name github-actions[bot]
git config user.email 41898282+github-actions[bot]@users.noreply.github.com
git add .
git commit -m "[bot] Auto formatted"
git push --set-upstream origin $BRANCH
git checkout main
echo "branch-name: $BRANCH"
echo "branch-name=$BRANCH" >> $GITHUB_OUTPUT
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
call-pull-request-workflow:
name: Call pull request workflow
needs: run-dotnet-format
uses: ./.github/workflows/github-pull-request-creation.yml
with:
branch-name: ${{ needs.run-dotnet-format.outputs.branch-name }}
show-pull-request-url:
name: Show pull request url
needs: call-pull-request-workflow
runs-on: ubuntu-latest
steps:
- run: echo ${{ needs.call-pull-request-workflow.outputs.pull-request-url }}