Skip to content

Commit e840292

Browse files
committed
Always use WSLv2 as default WSL version
1 parent c0fd238 commit e840292

5 files changed

Lines changed: 21 additions & 29 deletions

File tree

README.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Setup WSL
66

77
A GitHub action to install and setup a Linux distribution for the Windows Subsystem for Linux (WSL).
88

9-
Beginning with `windows-2019` virtual environment for GitHub actions, WSLv1 is enabled.
9+
Beginning with `windows-2019` virtual environment for GitHub actions, WSLv1 was enabled.
1010
Beginning with later `windows-2022` virtual environment version for GitHub actions, WSLv2 is also available.
1111
However, there is no Linux distribution installed by default and there is also no easy shell for
1212
`run` steps that executes commands within a WSL distribution.
@@ -334,13 +334,11 @@ work or break, so issues a warning for the action run. Currently, WSLv1 and WSLv
334334
issue a warning. If a new WSL version is available and your workflow works with it, please report an issue
335335
so that proper tests can be added and the warning for that version removed.
336336

337-
**Default value:**
338-
* `1` if running on `windows-2019` virtual environment as this is not yet supporting WSLv2
339-
* `2` if not running on `windows-2019` virtual environment
337+
**Default value:** `2`
340338

341339
_**Example:**_
342340
```yaml
343-
- uses: Vampire/setup-wsl@v3
341+
- uses: Vampire/setup-wsl@v5
344342
with:
345343
wsl-version: 1
346344
```

action.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,10 +100,8 @@ inputs:
100100
work or break, so issues a warning for the action run. Currently, WSLv1 and WSLv2 are tested and do not
101101
issue a warning. If a new WSL version is available and your workflow works with it, please report an issue
102102
so that proper tests can be added and the warning for that version removed.
103-
Default is '1' if running on 'windows-2019' virtual environment as this is not yet supporting WSLv2.
104-
Default is '2' if not running on 'windows-2019' virtual environment.
105103
required: false
106-
default: 1 | 2
104+
default: '2'
107105

108106
outputs:
109107
wsl-shell-wrapper-path:

readme/README.md.sha256

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
9c643460e0cd667e80b44c96e7fea9802d5b1d0be3b5f521aca2ac5c11d274c8
1+
99507fe69f9ee85368676c3b46bb44f6fb8646a3cd1043e30a08e967582a766b

readme/README_template.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Setup WSL
66

77
A GitHub action to install and setup a Linux distribution for the Windows Subsystem for Linux (WSL).
88

9-
Beginning with `windows-2019` virtual environment for GitHub actions, WSLv1 is enabled.
9+
Beginning with `windows-2019` virtual environment for GitHub actions, WSLv1 was enabled.
1010
Beginning with later `windows-2022` virtual environment version for GitHub actions, WSLv2 is also available.
1111
However, there is no Linux distribution installed by default and there is also no easy shell for
1212
`run` steps that executes commands within a WSL distribution.
@@ -334,13 +334,11 @@ work or break, so issues a warning for the action run. Currently, WSLv1 and WSLv
334334
issue a warning. If a new WSL version is available and your workflow works with it, please report an issue
335335
so that proper tests can be added and the warning for that version removed.
336336

337-
**Default value:**
338-
* `1` if running on `windows-2019` virtual environment as this is not yet supporting WSLv2
339-
* `2` if not running on `windows-2019` virtual environment
337+
**Default value:** `2`
340338

341339
_**Example:**_
342340
```yaml
343-
- uses: Vampire/setup-wsl@v3
341+
- uses: Vampire/setup-wsl@v$majorVersion
344342
with:
345343
wsl-version: 1
346344
```

src/jsMain/kotlin/net/kautler/github/action/setup_wsl/SetupWsl.kt

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -245,25 +245,23 @@ val wslShellCommand by lazy {
245245
}
246246

247247
val wslVersion = GlobalScope.async(start = LAZY) {
248-
when (val input = getInput("wsl-version", InputOptions(required = true))) {
249-
"1 | 2" -> if (wslHelp().contains("--set-default-version")) 2u else 1u
250-
else -> {
251-
input.toUIntOrNull().also { wslVersion ->
252-
when (wslVersion) {
253-
null, 0u -> error("'$input' is not a valid positive integer for 'wsl-version'.")
254-
1u -> Unit
255-
else -> {
256-
check(wslHelp().contains("--set-default-version")) {
257-
"This Windows environment only has WSLv1 available but WSLv$wslVersion was requested, please verify your 'runs-on' and 'wsl-version' settings"
258-
}
259-
if (wslVersion > 2u) {
260-
warning("WSLv$wslVersion is untested, if it works with your workflow please open an issue to get the version tested and this warning removed")
261-
}
248+
val input = getInput("wsl-version", InputOptions(required = true))
249+
input
250+
.toUIntOrNull()
251+
.also { wslVersion ->
252+
when (wslVersion) {
253+
null, 0u -> error("'$input' is not a valid positive integer for 'wsl-version'.")
254+
1u -> Unit
255+
else -> {
256+
check(wslHelp().contains("--set-default-version")) {
257+
"This Windows environment only has WSLv1 available but WSLv$wslVersion was requested, please verify your 'runs-on' and 'wsl-version' settings"
258+
}
259+
if (wslVersion > 2u) {
260+
warning("WSLv$wslVersion is untested, if it works with your workflow please open an issue to get the version tested and this warning removed")
262261
}
263262
}
264263
}
265264
}
266-
}
267265
}
268266

269267
val wslShellName by lazy {

0 commit comments

Comments
 (0)