This repository has been archived by the owner on Jan 5, 2024. It is now read-only.
Error when using setup-haskell
as a library
#122
Labels
help wanted
Extra attention is needed
re: inputs
Concerning handling the inputs to this action
refactor
Concerning refactoring the code base
Milestone
When called,
run
insetup-haskell.ts
reads the default values for its inputs from__dirname/../action.yml
. However,__dirname
is the absolute path of the directory containing the currently executing file, so when using this action as a library, that no longer resolves to the correct path. One of two things happens:action.yml
file, and (presumably) the code exits with a file-not-found error.action.yml
file, which does not contain the same keys.3.If (2) happens, issue 121 becomes relevant. The type given to
yamlInputs
pretends thataction.yml
provides defaults for any possible string, and so whensetup-haskell
finds anaction.yml
file, it fails with:Note that the defaults are read even when explicit values are provided.
There are a couple possible solutions:
main.ts
but not insetup-haskell.ts
. That way therun
function insetup-haskell.ts
can be assigned a type that communicates that it requires a value for every input.action.yml
. If it is too cumbersome to maintain the default values in two separate places, we could write a script that convertsaction.yml
toaction.json
on each commit, which we can then import fromsetup-haskell.ts
and bundle with the library. That way we can keep the defaults in one place without having to rely on__dirname
.The current workaround for this issue is to make sure an
action.yml
exists in__dirname
which contains the default values forghc-version
,cabal-version
, andstack-version
.The text was updated successfully, but these errors were encountered: