-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathaction.yml
More file actions
73 lines (66 loc) · 2.23 KB
/
action.yml
File metadata and controls
73 lines (66 loc) · 2.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
name: 'Format source code'
author: 'Pete Sramek'
description: 'Formats source code using dotnet format tool. Pushes changes to the current branch.'
inputs:
# Required
project-path:
description: 'Path to the project or solution file.'
required: true
# Optional
dotnet_sdk_version:
description: '.NET SDK version. Default: ''9.x'''
required: false
default: '9.x'
format-whitespace:
description: 'Format whitespace. Default: ''true'''
required: false
default: 'true'
format-style:
description: 'Format style. Default: ''true'''
required: false
default: 'true'
format-analyzers:
description: 'Format analyzers. Default: ''false'''
required: false
default: 'false'
format-analyzers-diagnostics-parameter:
description: 'Format analyzers diagnostics parameter. Default: '''''
required: false
default: ''
runs:
using: "composite"
steps:
- name: 'Checkout ${{ github.head_ref || github.ref }}'
uses: actions/checkout@v5
- name: 'Setup .NET ${{ inputs.dotnet_sdk_version }}'
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ inputs.dotnet_sdk_version }}
- name: Format whitespace
if: ${{ inputs.format-whitespace == 'true' }}
shell: bash
run: |
dotnet format whitespace
working-directory: ${{ github.workspace }}
- name: Format style
if: ${{ inputs.format-style == 'true' }}
shell: bash
run: |
dotnet format style
working-directory: ${{ github.workspace }}
- name: 'Set target branch'
if: ${{ inputs.format-analyzers == 'true' && inputs.format-analyzers-diagnostics-parameter != '' }}
id: set-diagnostics-parameter
shell: bash
run: |
echo "format-analyzers-diagnostics-parameter=--diagnostics ${{ inputs.format-analyzers-diagnostics-parameter }}" >> $GITHUB_OUTPUT
- name: Format analyzers
if: ${{ inputs.format-analyzers == 'true' }}
shell: bash
run: |
dotnet format analyzers ${{ env.format-analyzers-diagnostics-parameter }}
working-directory: ${{ github.workspace }}
- name: 'Push changes'
uses: './.github/actions/git/push-changes'
with:
commit-message: 'Formatted csharp files'