Skip to content

Commit

Permalink
Merge pull request #440 from muno92/feature-439-specify-dotnet-version
Browse files Browse the repository at this point in the history
Add option to specify dotnet version
  • Loading branch information
muno92 authored Nov 25, 2023
2 parents 786ad71 + cfa3232 commit 7623780
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 4 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/reusable-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,18 @@ jobs:
steps:
- uses: actions/checkout@v4
- uses: actions/setup-dotnet@v3
id: setup-dotnet
with:
dotnet-version: ${{ matrix.dotnet-version }}
- uses: ./
with:
solutionPath: TestSolution/TestSolution.sln
failOnIssue: '0'
minimumReportSeverity: 'WARNING'
dotnetVersion: ${{ steps.setup-dotnet.outputs.dotnet-version }}
# Reproduce second time execution on self-hosted runner
- uses: ./
with:
solutionPath: TestSolution/TestSolution.sln
failOnIssue: '0'
dotnetVersion: ${{ steps.setup-dotnet.outputs.dotnet-version }}
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,11 @@ Example:
Platform=x64;Configuration=Debug
```

### dotnetVersion

Lets you specify the version of the .NET SDK to use.
(Default is the latest version).

## Usage

```yaml
Expand All @@ -154,6 +159,7 @@ jobs:
- name: Checkout
uses: actions/checkout@v4
- name: Setup .NET
id: setup-dotnet
uses: actions/setup-dotnet@v3
with:
dotnet-version: '8.0.x' # [3.1.x, 5.0.x, 6.0.x, 7.0.x, 8.0.x]
Expand All @@ -163,4 +169,5 @@ jobs:
uses: muno92/resharper_inspectcode@v1
with:
solutionPath: ./YourSolution.sln
dotnetVersion: ${{ steps.setup-dotnet.outputs.dotnet-version }}
```
3 changes: 3 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ inputs:
properties:
required: false
description: Lets you override MSBuild properties. You can use a semicolon to separate multiple properties --properties:prop1=val1;prop2=val2.
dotnetVersion:
required: false
description: Lets you specify the version of the .NET SDK to use.
runs:
using: 'node20'
main: 'dist/index.js'
Expand Down
10 changes: 7 additions & 3 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,11 @@ async function run(): Promise<void> {
command += ` --properties:"${properties}"`
}

const dotnetVersion: string = core.getInput('dotnetVersion') ?? ''
if (dotnetVersion) {
command += ` --dotnetcoresdk=${dotnetVersion}`
}

const workingDir: string = core.getInput('workingDirectory')
if (workingDir) {
core.debug(`Changing to working directory: ${workingDir}`)
Expand Down

0 comments on commit 7623780

Please sign in to comment.