Skip to content

Commit 8da81dd

Browse files
committed
Add after_context, before_context, context inputs
1 parent 7e7899b commit 8da81dd

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

action.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,18 @@ inputs:
5050
description: "Files or directories to check"
5151
required: false
5252
default: ''
53+
after_context:
54+
description: "Print a number of lines of trailing context"
55+
required: false
56+
default: ''
57+
before_context:
58+
description: "Print a number of lines of leading context"
59+
required: false
60+
default: ''
61+
context:
62+
description: "Print a number of lines of surrounding context"
63+
required: false
64+
default: ''
5365
runs:
5466
using: 'docker'
5567
image: 'Dockerfile'

entrypoint.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,18 @@ echo "Files or directories to check: '${INPUT_SKIP}'"
5252
if [ "x${INPUT_FILES}" != "x" ]; then
5353
command_args="${command_args} --regex ${INPUT_FILES}"
5454
fi
55+
echo "Print a number of lines of trailing context: '${INPUT_AFTER_CONTEXT}'"
56+
if [ "x${INPUT_AFTER_CONTEXT}" != "x" ]; then
57+
command_args="${command_args} --after-context ${INPUT_AFTER_CONTEXT}"
58+
fi
59+
echo "Print a number of lines of leading context: '${INPUT_BEFORE_CONTEXT}'"
60+
if [ "x${INPUT_BEFORE_CONTEXT}" != "x" ]; then
61+
command_args="${command_args} --before-context ${INPUT_BEFORE_CONTEXT}"
62+
fi
63+
echo "Print a number of lines of surrounding context: '${INPUT_CONTEXT}'"
64+
if [ "x${INPUT_CONTEXT}" != "x" ]; then
65+
command_args="${command_args} --context ${INPUT_CONTEXT}"
66+
fi
5567
echo "Resulting CLI options ${command_args}"
5668
exec 5>&1
5769
res=`{ { codespell --count ${command_args} ${INPUT_PATH}; echo $? 1>&4; } 1>&5; } 4>&1`

0 commit comments

Comments
 (0)