diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 8ef489a..61629a7 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -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 diff --git a/README.md b/README.md index 4369625..4dc4a56 100644 --- a/README.md +++ b/README.md @@ -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 @@ -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 diff --git a/action.yml b/action.yml index 9288a71..300e2dc 100644 --- a/action.yml +++ b/action.yml @@ -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 diff --git a/lib/entrypoint.sh b/lib/entrypoint.sh index 75d15b4..cb15c21 100755 --- a/lib/entrypoint.sh +++ b/lib/entrypoint.sh @@ -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}"