diff --git a/action.yml b/action.yml index f33652f..5413bf5 100644 --- a/action.yml +++ b/action.yml @@ -9,6 +9,7 @@ runs: image: "Dockerfile" args: - ${{ inputs.case-sensitive }} + - ${{ inputs.require-colon }} inputs: terms: description: "The pipe-delimited searchable terms to pass as a regex group to `git grep`." @@ -18,3 +19,7 @@ inputs: description: "Whether the searchable terms passed to `git grep` should be case-sensitive or not." required: false default: true + require-colon: + description: "Whether the terms must be followed by a colon." + required: false + default: true diff --git a/lib/entrypoint.sh b/lib/entrypoint.sh index cb15c21..d39e12d 100755 --- a/lib/entrypoint.sh +++ b/lib/entrypoint.sh @@ -10,6 +10,7 @@ echo "::add-matcher::git-grep-problem-matcher.json" case_sensitive="${1}" +require_colon="${2}" if [ ${case_sensitive} = false ]; then case_sensitive="--ignore-case" @@ -19,7 +20,14 @@ fi tag=${INPUT_TERMS:=FIXME} -result=$(git grep --no-color ${case_sensitive} --line-number --extended-regexp -e "(${tag})+(:)" :^.github) + +regex="(${tag})+" + +if [ ${require_colon} = true ]; then + regex="${regex}(:)" +fi + +result=$(git grep --no-color ${case_sensitive} --line-number --extended-regexp -e "${regex}" :^.github) echo "${result}"