-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #31 from tsubakimoto/dotnet-format
dotnet-format workflow
- Loading branch information
Showing
5 changed files
with
137 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
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 }} |
This file contains 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
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 |
This file contains 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
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 | ||
} | ||
} |
This file contains 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
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() ); |
This file contains 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
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> |