Skip to content

Commit

Permalink
Merge pull request #31 from tsubakimoto/dotnet-format
Browse files Browse the repository at this point in the history
dotnet-format workflow
  • Loading branch information
tsubakimoto committed Jul 23, 2023
2 parents f828495 + cb52ec3 commit f55563f
Show file tree
Hide file tree
Showing 5 changed files with 137 additions and 0 deletions.
60 changes: 60 additions & 0 deletions .github/workflows/net80-dotnet-format.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: .NET 8.0 dotnet-format

on:
push:
branches:
- main
paths:
- 'dotnet/net8.0/**'
workflow_dispatch:

env:
DOTNET_VERSION: '8.0.x'
DOTNET_PREVIEW_VERSION: true
DOTNET_FORMAT_VERBOSITY: diag
SOURCE_CODE_PATH: 'consoleapp/consoleapp.csproj'
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'
steps:
- uses: actions/checkout@v3
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
include-prerelease: ${{ env.DOTNET_PREVIEW_VERSION }}
- name: Format on branch
run: |
dotnet format $SOURCE_CODE_PATH --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 }}
48 changes: 48 additions & 0 deletions dotnet/dotnet.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.5.002.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "net6.0", "net6.0", "{96F8E184-0AD2-4CC8-8B56-FC064C73E115}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "razorpageapp", "net6.0\razorpageapp\razorpageapp.csproj", "{C50F6517-AE24-4054-AA10-F95F304923DC}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "net7.0", "net7.0", "{C6100442-FD97-4ABB-87CD-451375F8E9F2}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "razorpageapp", "net7.0\razorpageapp\razorpageapp.csproj", "{1D2C0B5D-FCFD-4872-B38D-1661C8455F62}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "net8.0", "net8.0", "{82204ABB-A7FD-4904-BAFE-65834AFFFA3E}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "consoleapp", "net8.0\consoleapp\consoleapp.csproj", "{73EC3307-ECBB-4F89-9307-FA59F73C454A}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{C50F6517-AE24-4054-AA10-F95F304923DC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C50F6517-AE24-4054-AA10-F95F304923DC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C50F6517-AE24-4054-AA10-F95F304923DC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C50F6517-AE24-4054-AA10-F95F304923DC}.Release|Any CPU.Build.0 = Release|Any CPU
{1D2C0B5D-FCFD-4872-B38D-1661C8455F62}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1D2C0B5D-FCFD-4872-B38D-1661C8455F62}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1D2C0B5D-FCFD-4872-B38D-1661C8455F62}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1D2C0B5D-FCFD-4872-B38D-1661C8455F62}.Release|Any CPU.Build.0 = Release|Any CPU
{73EC3307-ECBB-4F89-9307-FA59F73C454A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{73EC3307-ECBB-4F89-9307-FA59F73C454A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{73EC3307-ECBB-4F89-9307-FA59F73C454A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{73EC3307-ECBB-4F89-9307-FA59F73C454A}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{C50F6517-AE24-4054-AA10-F95F304923DC} = {96F8E184-0AD2-4CC8-8B56-FC064C73E115}
{1D2C0B5D-FCFD-4872-B38D-1661C8455F62} = {C6100442-FD97-4ABB-87CD-451375F8E9F2}
{73EC3307-ECBB-4F89-9307-FA59F73C454A} = {82204ABB-A7FD-4904-BAFE-65834AFFFA3E}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {8058C698-71A0-4FDF-AB5F-EDA80872CE2F}
EndGlobalSection
EndGlobal
13 changes: 13 additions & 0 deletions dotnet/net8.0/consoleapp/Class1.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
namespace consoleapp;

internal class Class1
{
private string field1 = "hoge";

public string Property1
=> field1 ;

public string Greet () {
return $"Hello, World { Property1 }!" ; // comment
}
}
6 changes: 6 additions & 0 deletions dotnet/net8.0/consoleapp/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// See https://aka.ms/new-console-template for more information
using consoleapp;

var class1 =
new Class1 ( ) ;
Console .WriteLine( class1.Greet() );
10 changes: 10 additions & 0 deletions dotnet/net8.0/consoleapp/consoleapp.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

</Project>

0 comments on commit f55563f

Please sign in to comment.