diff --git a/read-file/action.py b/read-file/action.py index 3d1ff70..4c1a64b 100644 --- a/read-file/action.py +++ b/read-file/action.py @@ -23,15 +23,13 @@ def parse_args() -> Namespace: help="Local path or remote URL to the file to read.", ) parser.add_argument( - "parser", + "--parser", choices=["json", "yaml"], - nargs="?", help="Parser to use for the file.", ) parser.add_argument( - "default", + "--default", type=str, - nargs="?", help="Default value to use if the file is not found.", ) return parser.parse_args() diff --git a/read-file/action.yml b/read-file/action.yml index 491b236..155806f 100644 --- a/read-file/action.yml +++ b/read-file/action.yml @@ -48,6 +48,10 @@ runs: - name: Read JSON id: read shell: bash - run: python ${{ github.action_path }}/action.py ${{ inputs.path }} ${{ inputs.parser }} ${{ inputs.default }} + run: > + python ${{ github.action_path }}/action.py + ${{ inputs.path }} + ${{ inputs.parser && format('"--parser={0}"', input.parser) || '' }} + ${{ inputs.default && format('"--default={0}"', input.default) || '' }} env: GITHUB_TOKEN: ${{ github.token }}