From 87f77da49c5ffb6f9cfff1d2381cedbeb35556ca Mon Sep 17 00:00:00 2001 From: Andreas Abel Date: Tue, 22 Sep 2026 19:06:20 +0200 Subject: [PATCH] Allow symbolic ghcup channel names (like "prereleases") --- .github/workflows/workflow.yml | 15 +++++++++++---- dist/index.js | 4 ++-- lib/opts.d.ts | 2 +- lib/opts.js | 2 +- lib/setup-haskell.js | 2 +- src/opts.ts | 7 ++----- src/setup-haskell.ts | 6 +----- 7 files changed, 19 insertions(+), 19 deletions(-) diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml index c780ab9..48dea08 100644 --- a/.github/workflows/workflow.yml +++ b/.github/workflows/workflow.yml @@ -143,18 +143,25 @@ jobs: cabal: "3.10.2.0" cabal_update: "false" - # Test ghcup pre-release channel + # Test ghcup pre-release channel with symbolic name (issue #152) - os: ubuntu-latest - ghcup_release_channel: "https://raw.githubusercontent.com/haskell/ghcup-metadata/master/ghcup-prereleases-0.0.9.yaml" + ghcup_release_channel: "prereleases" plan: - ghc: "9.12.1.20250219" - # 2025-07-29: just not out yet: "9.10.2.20250725" + ghc: "10.0.0.20260917" + cabal: "latest" + + # Test ghcup pre-release channel with URL + - os: ubuntu-latest + ghcup_release_channel: "https://raw.githubusercontent.com/haskell/ghcup-metadata/master/ghcup-prereleases-0.1.0.yaml" + plan: + ghc: "9.14.1.20260916" cabal: "latest" # Test ghc nightly - os: ubuntu-latest ghcup_release_channel: "https://ghc.gitlab.haskell.org/ghcup-metadata/ghcup-nightlies-0.0.7.yaml" # 2025-07-29: 0.0.8 and 0.0.9 do not exist + # 2026-09-22: neither 0.1.0 plan: ghc: "latest-nightly" cabal: "latest" diff --git a/dist/index.js b/dist/index.js index 9690917..7c452c9 100644 --- a/dist/index.js +++ b/dist/index.js @@ -35579,7 +35579,7 @@ function getOpts({ ghc, cabal, stack }, os, inputs) { const stackSetupGhc = parseYAMLBoolean('stack-setup-ghc', inputs['stack-setup-ghc'] || 'false'); const stackEnable = parseYAMLBoolean('enable-stack', inputs['enable-stack'] || 'false'); const matcherDisable = parseYAMLBoolean('disable-matcher', inputs['disable-matcher'] || 'false'); - const ghcupReleaseChannel = parseURL('ghcup-release-channel', inputs['ghcup-release-channel'] || ''); + const ghcupReleaseChannel = inputs['ghcup-release-channel']; // Andreas, 2023-01-05, issue #29: // 'cabal-update' has a default value, so we should get a proper boolean always. // Andreas, 2023-01-06: This is not true if we use the action as a library. @@ -35728,7 +35728,7 @@ async function run(inputs) { // await addGhcupReleaseChannel('vanilla', os, arch); await (0, installer_1.addGhcupReleaseChannel)('prereleases', os, arch); if (opts.ghcup.releaseChannel) - await (0, installer_1.addGhcupReleaseChannel)(opts.ghcup.releaseChannel.toString(), os, arch); + await (0, installer_1.addGhcupReleaseChannel)(opts.ghcup.releaseChannel, os, arch); }); for (const [t, { resolved }] of Object.entries(opts).filter(o => o[1].enable)) { await core.group(`Preparing ${t} environment`, async () => (0, installer_1.resetTool)(t, resolved, os, arch)); diff --git a/lib/opts.d.ts b/lib/opts.d.ts index fae5d45..bb05145 100644 --- a/lib/opts.d.ts +++ b/lib/opts.d.ts @@ -16,7 +16,7 @@ export interface ProgramOpt { export interface Options { ghc: ProgramOpt; ghcup: { - releaseChannel?: URL; + releaseChannel?: string; }; cabal: ProgramOpt & { update: boolean; diff --git a/lib/opts.js b/lib/opts.js index 1aa070f..8b67ff3 100644 --- a/lib/opts.js +++ b/lib/opts.js @@ -151,7 +151,7 @@ function getOpts({ ghc, cabal, stack }, os, inputs) { const stackSetupGhc = parseYAMLBoolean('stack-setup-ghc', inputs['stack-setup-ghc'] || 'false'); const stackEnable = parseYAMLBoolean('enable-stack', inputs['enable-stack'] || 'false'); const matcherDisable = parseYAMLBoolean('disable-matcher', inputs['disable-matcher'] || 'false'); - const ghcupReleaseChannel = parseURL('ghcup-release-channel', inputs['ghcup-release-channel'] || ''); + const ghcupReleaseChannel = inputs['ghcup-release-channel']; // Andreas, 2023-01-05, issue #29: // 'cabal-update' has a default value, so we should get a proper boolean always. // Andreas, 2023-01-06: This is not true if we use the action as a library. diff --git a/lib/setup-haskell.js b/lib/setup-haskell.js index 100984a..9418bf7 100644 --- a/lib/setup-haskell.js +++ b/lib/setup-haskell.js @@ -86,7 +86,7 @@ async function run(inputs) { // await addGhcupReleaseChannel('vanilla', os, arch); await (0, installer_1.addGhcupReleaseChannel)('prereleases', os, arch); if (opts.ghcup.releaseChannel) - await (0, installer_1.addGhcupReleaseChannel)(opts.ghcup.releaseChannel.toString(), os, arch); + await (0, installer_1.addGhcupReleaseChannel)(opts.ghcup.releaseChannel, os, arch); }); for (const [t, { resolved }] of Object.entries(opts).filter(o => o[1].enable)) { await core.group(`Preparing ${t} environment`, async () => (0, installer_1.resetTool)(t, resolved, os, arch)); diff --git a/src/opts.ts b/src/opts.ts index 7d43683..c59cb1b 100644 --- a/src/opts.ts +++ b/src/opts.ts @@ -25,7 +25,7 @@ export interface ProgramOpt { export interface Options { ghc: ProgramOpt; - ghcup: {releaseChannel?: URL}; + ghcup: {releaseChannel?: string}; cabal: ProgramOpt & {update: boolean}; stack: ProgramOpt & {setup: boolean}; general: {matcher: {enable: boolean}}; @@ -170,10 +170,7 @@ export function getOpts( 'disable-matcher', inputs['disable-matcher'] || 'false' ); - const ghcupReleaseChannel = parseURL( - 'ghcup-release-channel', - inputs['ghcup-release-channel'] || '' - ); + const ghcupReleaseChannel = inputs['ghcup-release-channel']; // Andreas, 2023-01-05, issue #29: // 'cabal-update' has a default value, so we should get a proper boolean always. // Andreas, 2023-01-06: This is not true if we use the action as a library. diff --git a/src/setup-haskell.ts b/src/setup-haskell.ts index 4a68e03..f7a24b8 100644 --- a/src/setup-haskell.ts +++ b/src/setup-haskell.ts @@ -53,11 +53,7 @@ export default async function run( // await addGhcupReleaseChannel('vanilla', os, arch); await addGhcupReleaseChannel('prereleases', os, arch); if (opts.ghcup.releaseChannel) - await addGhcupReleaseChannel( - opts.ghcup.releaseChannel.toString(), - os, - arch - ); + await addGhcupReleaseChannel(opts.ghcup.releaseChannel, os, arch); }); for (const [t, {resolved}] of Object.entries(opts).filter(