Open git-developer opened 1 year ago
The GitHub Action is limited to a single input argument.
Currently, action.yml looks like this:
args: - appimage-builder - '--recipe=${{ inputs.recipe }}' - '${{ inputs.args }}'
inputs.args is not a list, but a single string. Thus it is not possible to use more than one argument. Example:
inputs.args
uses: AppImageCrafters/build-appimage@v1.3 with: recipe: dist/AppImageBuilder.yml args: --skip-tests --appdir "Custom AppDir"
This will run the appimage-builder container with 3 arguments:
appimage-builder
--recipe=dist/AppImageBuilder.yml
--skip-tests --appdir "Custom AppDir"
The container run fails because it the input args are merged into one big string:
/usr/bin/docker run [...] appimagecrafters/appimage-builder:1.1.0 "appimage-builder" "--recipe=dist/AppImageBuilder.yml" "--appdir \"CustomAppDir\" --skip-tests" usage: appimage-builder [-h] [-v] [--recipe RECIPE] [--build-dir BUILD_DIR] [--appdir APPDIR] [--log LOGLEVEL] [--skip-script] [--skip-build] [--skip-tests] [--skip-appimage] [--generate] appimage-builder: error: unrecognized arguments: "--skip-tests --appdir \"Custom AppDir\""
The image must be called using a JSON list instead (see docs):
runs: using: 'docker' image: docker://appimagecrafters/appimage-builder:1.1.0 args: [ "appimage-builder", "--recipe=dist/AppImageBuilder.yml", "--skip-tests", "--appdir", "Custom AppDir" ]
To do that, input.args must be split. There are several possibilities todo that.
input.args
docker/build-push-action uses newlines as separator. It would look like
docker/build-push-action
- build-args: | --skip-tests --appdir "Custom AppDir"
I don't know how to convert this to a JSON list, they use a library.
An alternative is to use the string representation of a JSON list. This would look like:
- build-args: '[ "--skip-tests", "--appdir", "Custom AppDir" ]'
This string can be converted to a JSON list using the fromJSON() function.
Once the arguments are in JSON list representation, the two args appimage-builder and --recipe=... have to be added to the head of the list.
--recipe=...
Problem
The GitHub Action is limited to a single input argument.
Cause
Currently, action.yml looks like this:
inputs.args
is not a list, but a single string. Thus it is not possible to use more than one argument. Example:This will run the appimage-builder container with 3 arguments:
appimage-builder
--recipe=dist/AppImageBuilder.yml
--skip-tests --appdir "Custom AppDir"
The container run fails because it the input args are merged into one big string:
Possible Solutions
The image must be called using a JSON list instead (see docs):
To do that,
input.args
must be split. There are several possibilities todo that.Newline-separated list
docker/build-push-action
uses newlines as separator. It would look likeI don't know how to convert this to a JSON list, they use a library.
JSON list
An alternative is to use the string representation of a JSON list. This would look like:
This string can be converted to a JSON list using the fromJSON() function.
Once the arguments are in JSON list representation, the two args
appimage-builder
and--recipe=...
have to be added to the head of the list.