Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make the search sensitivity configurable #4

Merged
merged 2 commits into from
Jun 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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