-
Notifications
You must be signed in to change notification settings - Fork 9
Description
Problem
The GitHub Action is limited to a single input argument.
Cause
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:
uses: AppImageCrafters/[email protected]
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\""
Possible Solutions
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.
Newline-separated list
docker/build-push-action
uses newlines as separator. It would look like
- build-args: |
--skip-tests
--appdir
"Custom AppDir"
I 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:
- 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.