Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
102 changes: 51 additions & 51 deletions .github/actions/setup-dotnet/action.yml
Original file line number Diff line number Diff line change
@@ -1,51 +1,51 @@
name: Setup .NET
description: >-
Installs the exact .NET SDK pinned by global.json, quiets the CLI and restores the listed solutions or projects in
locked mode.

inputs:
restore:
description: >-
Newline-separated solutions or projects, each restored with 'dotnet restore <entry> --locked-mode'. Empty skips
the restore.
required: false
default: ''
cache:
description: >-
Cache the NuGet global-packages folder, keyed on every packages.lock.json. Keep 'false' in every workflow a
release, Sonar or CodeQL run can reach (a poisoned cache would feed the published packages).
required: false
default: 'false'

runs:
using: composite
steps:
# global.json sets rollForward: disable, and runner images do not ship the pinned feature band, so every job that
# runs dotnet installs it here.
- name: Install SDK
uses: actions/setup-dotnet@a98b56852c35b8e3190ac28c8c2271da59106c68 # v6.0.0
with:
global-json-file: global.json
cache: ${{ inputs.cache }}
cache-dependency-path: '**/packages.lock.json'

- name: Configure CLI
shell: pwsh
run: |
'DOTNET_NOLOGO=1', 'DOTNET_CLI_TELEMETRY_OPTOUT=1', 'MSBUILDDISABLENODEREUSE=1' |
Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8

- name: Restore (locked)
if: inputs.restore != ''
shell: pwsh
env:
RESTORE_TARGETS: ${{ inputs.restore }}
run: |
$ErrorActionPreference = 'Stop'
$targets = @($env:RESTORE_TARGETS -split "`n" | ForEach-Object { $_.Trim() } | Where-Object { $_ })
foreach ($target in $targets) {
dotnet restore $target --locked-mode
if ($LASTEXITCODE -ne 0) {
throw "Locked restore of '$target' failed with exit code $LASTEXITCODE. The committed packages.lock.json files do not match the project graph: regenerate them with 'dotnet restore <project> --force-evaluate' (Windows, the .NET SDK of global.json) and commit the result."
}
}
name: Setup .NET
description: >-
Installs the exact .NET SDK pinned by global.json, quiets the CLI and restores the listed solutions or projects in
locked mode.
inputs:
restore:
description: >-
Newline-separated solutions or projects, each restored with 'dotnet restore <entry> --locked-mode'. Empty skips
the restore.
required: false
default: ''
cache:
description: >-
Cache the NuGet global-packages folder, keyed on every packages.lock.json. Keep 'false' in every workflow a
release, Sonar or CodeQL run can reach (a poisoned cache would feed the published packages).
required: false
default: 'false'
runs:
using: composite
steps:
# global.json sets rollForward: disable, and runner images do not ship the pinned feature band, so every job that
# runs dotnet installs it here.
- name: Install SDK
uses: actions/setup-dotnet@0f4a354dd5547a28c70b7853dbd95d5b67886e73 # v6.1.0
with:
global-json-file: global.json
cache: ${{ inputs.cache }}
cache-dependency-path: '**/packages.lock.json'
- name: Configure CLI
shell: pwsh
run: |
'DOTNET_NOLOGO=1', 'DOTNET_CLI_TELEMETRY_OPTOUT=1', 'MSBUILDDISABLENODEREUSE=1' |
Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8
- name: Restore (locked)
if: inputs.restore != ''
shell: pwsh
env:
RESTORE_TARGETS: ${{ inputs.restore }}
run: |
$ErrorActionPreference = 'Stop'
$targets = @($env:RESTORE_TARGETS -split "`n" | ForEach-Object { $_.Trim() } | Where-Object { $_ })
foreach ($target in $targets) {
dotnet restore $target --locked-mode
if ($LASTEXITCODE -ne 0) {
throw "Locked restore of '$target' failed with exit code $LASTEXITCODE. The committed packages.lock.json files do not match the project graph: regenerate them with 'dotnet restore <project> --force-evaluate' (Windows, the .NET SDK of global.json) and commit the result."
}
}
Loading
Loading