Skip to content

Commit

Permalink
Make the search sensitivity configurable (#4)
Browse files Browse the repository at this point in the history
* Make the search sensitivity configruable

* fix a typo
  • Loading branch information
zaherg committed Jun 21, 2022
1 parent 301f4db commit 82f548e
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 2 deletions.
14 changes: 13 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,24 @@ on:
- 'releases/*'

jobs:
test:
test-case-sensitive:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: ./
with:
terms: "wip|fix|fixme"
case-sensitive: true
env:
ENVIRONMENT: test

test-case-insensitive:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: ./
with:
terms: "wip|fix|fixme"
case-sensitive: false
env:
ENVIRONMENT: test
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ jobs:
- uses: bbugh/action-fixme-check@master # or @ the latest release
with:
terms: 'WIP|FIXME' # optional, defaults to `FIXME`
case-sensitive: false # optional, defaults to `false`
```
## Support
Expand All @@ -48,6 +49,8 @@ jobs:
- I am using `FIXME:` here.
- Nothing to see here.
- I am using `FIX:` here.
- I am using `wip:` here.
- I am using `fixme:` here.

## License

Expand Down
6 changes: 6 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,15 @@ branding:
runs:
using: 'docker'
image: 'Dockerfile'
args:
- ${{ inputs.case-sensitive }}
inputs:
terms:
description: 'The pipe-delimited searchable terms to pass as a regex group to `git grep`.'
required: false
default: "FIXME"
case-sensitive:
description: 'Whether the searchable terms passed to `git grep` should be case-sensitive or not.'
required: false
default: false

12 changes: 11 additions & 1 deletion lib/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,18 @@ cp /git-grep-problem-matcher.json "$matcher_path"

echo "::add-matcher::git-grep-problem-matcher.json"


case_sensitive="${1}"

if [ ${case_sensitive} = false ]; then
case_sensitive="--ignore-case"
else
unset case_sensitive
fi


tag=${INPUT_TERMS:=FIXME}
result=$(git grep --no-color --line-number --extended-regexp -e "(${tag})+(:)" :^.github)
result=$(git grep --no-color ${case_sensitive} --line-number --extended-regexp -e "(${tag})+(:)" :^.github)

echo "${result}"

Expand Down

0 comments on commit 82f548e

Please sign in to comment.