-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaction.yml
More file actions
51 lines (49 loc) · 1.41 KB
/
Copy pathaction.yml
File metadata and controls
51 lines (49 loc) · 1.41 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
name: "[.NET]Code Formatting"
inputs:
project:
required: true
type: string
project-name:
required: true
type: string
nuget-sources:
required: false
type: string
export-output:
required: false
type: boolean
default: 'true'
excluded-projects:
required: false
type: string
outputs:
changes:
description: "Git Diff Changes"
value: ${{ steps.changes.outputs.changes }}
runs:
using: "composite"
steps:
- name: Setup .NET
uses: actions/setup-dotnet@v2
with:
dotnet-version: 6.0.x
- uses: xt0rted/dotnet-format-problem-matcher@v1.2.0
- name: Restore
run: dotnet restore -s ${{ inputs.nuget-sources }} -s https://api.nuget.org/v3/index.json /property:Configuration=ReleaseNoMaui
shell: bash
- run: dotnet format ${{ inputs.project }} --no-restore
if: ${{ inputs.excluded-projects == '' }}
shell: bash
- run: dotnet format ${{ inputs.project }} --exclude ${{ inputs.excluded-projects }} --no-restore
if: ${{ inputs.excluded-projects != '' }}
shell: bash
- id: changes
if: ${{ inputs.export-output == 'true' }}
run: |
git diff >> output.patch
GIT_DIFF=$(cat output.patch)
GIT_DIFF="${GIT_DIFF//'%'/'%25'}"
GIT_DIFF="${GIT_DIFF//$'\n'/'%0A'}"
GIT_DIFF="${GIT_DIFF//$'\r'/'%0D'}"
echo "::set-output name=changes::$GIT_DIFF"
shell: bash