Skip to content

Commit e5717e2

Browse files
committed
Make procuctId to URL translation work again (#50)
1 parent a6c8b14 commit e5717e2

File tree

3 files changed

+75
-29
lines changed

3 files changed

+75
-29
lines changed

.github/workflows/test.main.kts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,7 @@ val ubuntu1604 = mapOf(
108108

109109
val distributions = listOf(
110110
debian,
111-
// disable testing on Alpine for the time being due to https://github.com/Vampire/setup-wsl/issues/50
112-
//alpine,
111+
alpine,
113112
kali,
114113
openSuseLeap15_2,
115114
ubuntu2204,

.github/workflows/test.yaml

Lines changed: 70 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -336,6 +336,10 @@ jobs:
336336
user-id: 'Debian'
337337
match-pattern: '*Debian*'
338338
default-absent-tool: 'dos2unix'
339+
- wsl-id: 'Alpine'
340+
user-id: 'Alpine'
341+
match-pattern: '*Alpine*'
342+
default-absent-tool: 'dos2unix'
339343
- wsl-id: 'kali-linux'
340344
user-id: 'kali-linux'
341345
match-pattern: '*Kali*'
@@ -824,6 +828,10 @@ jobs:
824828
user-id: 'Debian'
825829
match-pattern: '*Debian*'
826830
default-absent-tool: 'dos2unix'
831+
- wsl-id: 'Alpine'
832+
user-id: 'Alpine'
833+
match-pattern: '*Alpine*'
834+
default-absent-tool: 'dos2unix'
827835
- wsl-id: 'kali-linux'
828836
user-id: 'kali-linux'
829837
match-pattern: '*Kali*'
@@ -920,6 +928,10 @@ jobs:
920928
user-id: 'Debian'
921929
match-pattern: '*Debian*'
922930
default-absent-tool: 'dos2unix'
931+
- wsl-id: 'Alpine'
932+
user-id: 'Alpine'
933+
match-pattern: '*Alpine*'
934+
default-absent-tool: 'dos2unix'
923935
- wsl-id: 'kali-linux'
924936
user-id: 'kali-linux'
925937
match-pattern: '*Kali*'
@@ -1049,6 +1061,10 @@ jobs:
10491061
user-id: 'Debian'
10501062
match-pattern: '*Debian*'
10511063
default-absent-tool: 'dos2unix'
1064+
- wsl-id: 'Alpine'
1065+
user-id: 'Alpine'
1066+
match-pattern: '*Alpine*'
1067+
default-absent-tool: 'dos2unix'
10521068
- wsl-id: 'kali-linux'
10531069
user-id: 'kali-linux'
10541070
match-pattern: '*Kali*'
@@ -1274,6 +1290,10 @@ jobs:
12741290
user-id: 'Debian'
12751291
match-pattern: '*Debian*'
12761292
default-absent-tool: 'dos2unix'
1293+
- wsl-id: 'Alpine'
1294+
user-id: 'Alpine'
1295+
match-pattern: '*Alpine*'
1296+
default-absent-tool: 'dos2unix'
12771297
- wsl-id: 'kali-linux'
12781298
user-id: 'kali-linux'
12791299
match-pattern: '*Kali*'
@@ -1479,26 +1499,31 @@ jobs:
14791499
match-pattern: '*Debian*'
14801500
default-absent-tool: 'dos2unix'
14811501
distribution2:
1502+
wsl-id: 'Alpine'
1503+
user-id: 'Alpine'
1504+
match-pattern: '*Alpine*'
1505+
default-absent-tool: 'dos2unix'
1506+
distribution3:
14821507
wsl-id: 'kali-linux'
14831508
user-id: 'kali-linux'
14841509
match-pattern: '*Kali*'
14851510
default-absent-tool: 'dos2unix'
1486-
distribution3:
1511+
distribution4:
14871512
wsl-id: 'openSUSE-Leap-15.2'
14881513
user-id: 'openSUSE-Leap-15.2'
14891514
match-pattern: '*openSUSE*Leap*15.2*'
14901515
default-absent-tool: 'which'
1491-
distribution4:
1516+
distribution5:
14921517
wsl-id: 'Ubuntu'
14931518
user-id: 'Ubuntu-20.04'
14941519
match-pattern: '*Ubuntu*20.04*'
14951520
default-absent-tool: 'dos2unix'
1496-
distribution5:
1521+
distribution6:
14971522
wsl-id: 'Ubuntu-18.04'
14981523
user-id: 'Ubuntu-18.04'
14991524
match-pattern: '*Ubuntu*18.04*'
15001525
default-absent-tool: 'dos2unix'
1501-
distribution6:
1526+
distribution7:
15021527
wsl-id: 'Ubuntu-16.04'
15031528
user-id: 'Ubuntu-16.04'
15041529
match-pattern: '*Ubuntu*16.04*'
@@ -1509,26 +1534,31 @@ jobs:
15091534
match-pattern: '*Debian*'
15101535
default-absent-tool: 'dos2unix'
15111536
distribution2:
1537+
wsl-id: 'Alpine'
1538+
user-id: 'Alpine'
1539+
match-pattern: '*Alpine*'
1540+
default-absent-tool: 'dos2unix'
1541+
distribution3:
15121542
wsl-id: 'kali-linux'
15131543
user-id: 'kali-linux'
15141544
match-pattern: '*Kali*'
15151545
default-absent-tool: 'dos2unix'
1516-
distribution3:
1546+
distribution4:
15171547
wsl-id: 'openSUSE-Leap-15.2'
15181548
user-id: 'openSUSE-Leap-15.2'
15191549
match-pattern: '*openSUSE*Leap*15.2*'
15201550
default-absent-tool: 'which'
1521-
distribution4:
1551+
distribution5:
15221552
wsl-id: 'Ubuntu'
15231553
user-id: 'Ubuntu-22.04'
15241554
match-pattern: '*Ubuntu*22.04*'
15251555
default-absent-tool: 'dos2unix'
1526-
distribution5:
1556+
distribution6:
15271557
wsl-id: 'Ubuntu-18.04'
15281558
user-id: 'Ubuntu-18.04'
15291559
match-pattern: '*Ubuntu*18.04*'
15301560
default-absent-tool: 'dos2unix'
1531-
distribution6:
1561+
distribution7:
15321562
wsl-id: 'Ubuntu-16.04'
15331563
user-id: 'Ubuntu-16.04'
15341564
match-pattern: '*Ubuntu*16.04*'
@@ -1579,6 +1609,12 @@ jobs:
15791609
distribution: '${{ matrix.distributions.distribution6.user-id }}'
15801610
set-as-default: 'false'
15811611
- id: 'step-7'
1612+
name: 'Execute action for ${{ matrix.distributions.distribution7.user-id }}'
1613+
uses: './'
1614+
with:
1615+
distribution: '${{ matrix.distributions.distribution7.user-id }}'
1616+
set-as-default: 'false'
1617+
- id: 'step-8'
15821618
name: 'Test - wsl-bash_${{ matrix.distributions.distribution1.user-id }} should use the correct distribution'
15831619
shell: 'wsl-bash_Debian {0}'
15841620
run: |-
@@ -1587,59 +1623,68 @@ jobs:
15871623
if: |-
15881624
always()
15891625
&& (steps.step-1.outcome == 'success')
1590-
- id: 'step-8'
1626+
- id: 'step-9'
15911627
name: 'Test - wsl-bash_${{ matrix.distributions.distribution2.user-id }} should use the correct distribution'
1592-
shell: 'wsl-bash_kali-linux {0}'
1628+
shell: 'wsl-bash_Alpine {0}'
15931629
run: |-
15941630
cat <(lsb_release -a || true) <(uname -a || true) <([ -d /etc ] && find /etc -maxdepth 1 -type f \( -name '*release' -or -name 'issue*' \) -exec cat {} + || true) <([ -d /etc/products.d ] && find /etc/products.d -maxdepth 1 -type f -name '*.prod' -exec cat {} + || true) <([ -f /proc/version ] && cat /proc/version || true)
15951631
[[ "$(cat <(lsb_release -a || true) <(uname -a || true) <([ -d /etc ] && find /etc -maxdepth 1 -type f \( -name '*release' -or -name 'issue*' \) -exec cat {} + || true) <([ -d /etc/products.d ] && find /etc/products.d -maxdepth 1 -type f -name '*.prod' -exec cat {} + || true) <([ -f /proc/version ] && cat /proc/version || true))" == ${{ matrix.distributions.distribution2.match-pattern }} ]]
15961632
if: |-
15971633
always()
15981634
&& (steps.step-2.outcome == 'success')
1599-
- id: 'step-9'
1635+
- id: 'step-10'
16001636
name: 'Test - wsl-bash_${{ matrix.distributions.distribution3.user-id }} should use the correct distribution'
1601-
shell: 'wsl-bash_openSUSE-Leap-15.2 {0}'
1637+
shell: 'wsl-bash_kali-linux {0}'
16021638
run: |-
16031639
cat <(lsb_release -a || true) <(uname -a || true) <([ -d /etc ] && find /etc -maxdepth 1 -type f \( -name '*release' -or -name 'issue*' \) -exec cat {} + || true) <([ -d /etc/products.d ] && find /etc/products.d -maxdepth 1 -type f -name '*.prod' -exec cat {} + || true) <([ -f /proc/version ] && cat /proc/version || true)
16041640
[[ "$(cat <(lsb_release -a || true) <(uname -a || true) <([ -d /etc ] && find /etc -maxdepth 1 -type f \( -name '*release' -or -name 'issue*' \) -exec cat {} + || true) <([ -d /etc/products.d ] && find /etc/products.d -maxdepth 1 -type f -name '*.prod' -exec cat {} + || true) <([ -f /proc/version ] && cat /proc/version || true))" == ${{ matrix.distributions.distribution3.match-pattern }} ]]
16051641
if: |-
16061642
always()
16071643
&& (steps.step-3.outcome == 'success')
1608-
- id: 'step-10'
1644+
- id: 'step-11'
16091645
name: 'Test - wsl-bash_${{ matrix.distributions.distribution4.user-id }} should use the correct distribution'
1610-
shell: 'wsl-bash_Ubuntu-22.04 {0}'
1646+
shell: 'wsl-bash_openSUSE-Leap-15.2 {0}'
16111647
run: |-
16121648
cat <(lsb_release -a || true) <(uname -a || true) <([ -d /etc ] && find /etc -maxdepth 1 -type f \( -name '*release' -or -name 'issue*' \) -exec cat {} + || true) <([ -d /etc/products.d ] && find /etc/products.d -maxdepth 1 -type f -name '*.prod' -exec cat {} + || true) <([ -f /proc/version ] && cat /proc/version || true)
16131649
[[ "$(cat <(lsb_release -a || true) <(uname -a || true) <([ -d /etc ] && find /etc -maxdepth 1 -type f \( -name '*release' -or -name 'issue*' \) -exec cat {} + || true) <([ -d /etc/products.d ] && find /etc/products.d -maxdepth 1 -type f -name '*.prod' -exec cat {} + || true) <([ -f /proc/version ] && cat /proc/version || true))" == ${{ matrix.distributions.distribution4.match-pattern }} ]]
16141650
if: |-
16151651
always()
16161652
&& (steps.step-4.outcome == 'success')
1617-
&& (matrix.distributions.distribution4.user-id != 'Ubuntu-20.04')
1618-
- id: 'step-11'
1619-
name: 'Test - wsl-bash_${{ matrix.distributions.distribution4.user-id }} should use the correct distribution'
1620-
shell: 'wsl-bash_Ubuntu-20.04 {0}'
1653+
- id: 'step-12'
1654+
name: 'Test - wsl-bash_${{ matrix.distributions.distribution5.user-id }} should use the correct distribution'
1655+
shell: 'wsl-bash_Ubuntu-22.04 {0}'
16211656
run: |-
16221657
cat <(lsb_release -a || true) <(uname -a || true) <([ -d /etc ] && find /etc -maxdepth 1 -type f \( -name '*release' -or -name 'issue*' \) -exec cat {} + || true) <([ -d /etc/products.d ] && find /etc/products.d -maxdepth 1 -type f -name '*.prod' -exec cat {} + || true) <([ -f /proc/version ] && cat /proc/version || true)
1623-
[[ "$(cat <(lsb_release -a || true) <(uname -a || true) <([ -d /etc ] && find /etc -maxdepth 1 -type f \( -name '*release' -or -name 'issue*' \) -exec cat {} + || true) <([ -d /etc/products.d ] && find /etc/products.d -maxdepth 1 -type f -name '*.prod' -exec cat {} + || true) <([ -f /proc/version ] && cat /proc/version || true))" == ${{ matrix.distributions.distribution4.match-pattern }} ]]
1658+
[[ "$(cat <(lsb_release -a || true) <(uname -a || true) <([ -d /etc ] && find /etc -maxdepth 1 -type f \( -name '*release' -or -name 'issue*' \) -exec cat {} + || true) <([ -d /etc/products.d ] && find /etc/products.d -maxdepth 1 -type f -name '*.prod' -exec cat {} + || true) <([ -f /proc/version ] && cat /proc/version || true))" == ${{ matrix.distributions.distribution5.match-pattern }} ]]
16241659
if: |-
16251660
always()
1626-
&& (steps.step-4.outcome == 'success')
1627-
&& (matrix.distributions.distribution4.user-id != 'Ubuntu-22.04')
1628-
- id: 'step-12'
1661+
&& (steps.step-5.outcome == 'success')
1662+
&& (matrix.distributions.distribution5.user-id != 'Ubuntu-20.04')
1663+
- id: 'step-13'
16291664
name: 'Test - wsl-bash_${{ matrix.distributions.distribution5.user-id }} should use the correct distribution'
1630-
shell: 'wsl-bash_Ubuntu-18.04 {0}'
1665+
shell: 'wsl-bash_Ubuntu-20.04 {0}'
16311666
run: |-
16321667
cat <(lsb_release -a || true) <(uname -a || true) <([ -d /etc ] && find /etc -maxdepth 1 -type f \( -name '*release' -or -name 'issue*' \) -exec cat {} + || true) <([ -d /etc/products.d ] && find /etc/products.d -maxdepth 1 -type f -name '*.prod' -exec cat {} + || true) <([ -f /proc/version ] && cat /proc/version || true)
16331668
[[ "$(cat <(lsb_release -a || true) <(uname -a || true) <([ -d /etc ] && find /etc -maxdepth 1 -type f \( -name '*release' -or -name 'issue*' \) -exec cat {} + || true) <([ -d /etc/products.d ] && find /etc/products.d -maxdepth 1 -type f -name '*.prod' -exec cat {} + || true) <([ -f /proc/version ] && cat /proc/version || true))" == ${{ matrix.distributions.distribution5.match-pattern }} ]]
16341669
if: |-
16351670
always()
16361671
&& (steps.step-5.outcome == 'success')
1637-
- id: 'step-13'
1672+
&& (matrix.distributions.distribution5.user-id != 'Ubuntu-22.04')
1673+
- id: 'step-14'
16381674
name: 'Test - wsl-bash_${{ matrix.distributions.distribution6.user-id }} should use the correct distribution'
1639-
shell: 'wsl-bash_Ubuntu-16.04 {0}'
1675+
shell: 'wsl-bash_Ubuntu-18.04 {0}'
16401676
run: |-
16411677
cat <(lsb_release -a || true) <(uname -a || true) <([ -d /etc ] && find /etc -maxdepth 1 -type f \( -name '*release' -or -name 'issue*' \) -exec cat {} + || true) <([ -d /etc/products.d ] && find /etc/products.d -maxdepth 1 -type f -name '*.prod' -exec cat {} + || true) <([ -f /proc/version ] && cat /proc/version || true)
16421678
[[ "$(cat <(lsb_release -a || true) <(uname -a || true) <([ -d /etc ] && find /etc -maxdepth 1 -type f \( -name '*release' -or -name 'issue*' \) -exec cat {} + || true) <([ -d /etc/products.d ] && find /etc/products.d -maxdepth 1 -type f -name '*.prod' -exec cat {} + || true) <([ -f /proc/version ] && cat /proc/version || true))" == ${{ matrix.distributions.distribution6.match-pattern }} ]]
16431679
if: |-
16441680
always()
16451681
&& (steps.step-6.outcome == 'success')
1682+
- id: 'step-15'
1683+
name: 'Test - wsl-bash_${{ matrix.distributions.distribution7.user-id }} should use the correct distribution'
1684+
shell: 'wsl-bash_Ubuntu-16.04 {0}'
1685+
run: |-
1686+
cat <(lsb_release -a || true) <(uname -a || true) <([ -d /etc ] && find /etc -maxdepth 1 -type f \( -name '*release' -or -name 'issue*' \) -exec cat {} + || true) <([ -d /etc/products.d ] && find /etc/products.d -maxdepth 1 -type f -name '*.prod' -exec cat {} + || true) <([ -f /proc/version ] && cat /proc/version || true)
1687+
[[ "$(cat <(lsb_release -a || true) <(uname -a || true) <([ -d /etc ] && find /etc -maxdepth 1 -type f \( -name '*release' -or -name 'issue*' \) -exec cat {} + || true) <([ -d /etc/products.d ] && find /etc/products.d -maxdepth 1 -type f -name '*.prod' -exec cat {} + || true) <([ -f /proc/version ] && cat /proc/version || true))" == ${{ matrix.distributions.distribution7.match-pattern }} ]]
1688+
if: |-
1689+
always()
1690+
&& (steps.step-7.outcome == 'success')

src/main/kotlin/net/kautler/github/action/setup_wsl/Distribution.kt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,8 @@ sealed class Distribution(
6363
requestUrl = "https://store.rg-adguard.net/api/GetFiles",
6464
data = "type=ProductId&url=$productId",
6565
additionalHeaders = recordOf(
66-
"Content-Type" to "application/x-www-form-urlencoded"
66+
"Content-Type" to "application/x-www-form-urlencoded",
67+
"User-Agent" to "Setup WSL GitHub Action"
6768
)
6869
).await()
6970

@@ -73,7 +74,8 @@ sealed class Distribution(
7374
requestUrl = "https://echo.free.beeceptor.com/api/GetFiles",
7475
data = "type=ProductId&url=$productId",
7576
additionalHeaders = recordOf(
76-
"Content-Type" to "application/x-www-form-urlencoded"
77+
"Content-Type" to "application/x-www-form-urlencoded",
78+
"User-Agent" to "Setup WSL GitHub Action"
7779
)
7880
).await()
7981
if (echoResponse.message.statusCode == 200) {

0 commit comments

Comments
 (0)