Skip to content

Commit

Permalink
Convert positionals to options
Browse files Browse the repository at this point in the history
  • Loading branch information
kenodegard committed Sep 9, 2024
1 parent e060186 commit 3081552
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
6 changes: 2 additions & 4 deletions read-file/action.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
6 changes: 5 additions & 1 deletion read-file/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}

0 comments on commit 3081552

Please sign in to comment.