From 4eee224120a7d48abaabc779145fb9710b17fc19 Mon Sep 17 00:00:00 2001 From: Zaher Ghaibeh Date: Mon, 20 Jun 2022 11:25:39 +0300 Subject: [PATCH 1/2] Make the search sensitivity configruable --- .github/workflows/test.yml | 14 +++++++++++++- README.md | 3 +++ action.yml | 6 ++++++ lib/entrypoint.sh | 12 +++++++++++- 4 files changed, 33 insertions(+), 2 deletions(-) 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..a4475df 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 pass 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}" From 73b4fce1c33bc264a55ec1d63918a21a9c0d49d7 Mon Sep 17 00:00:00 2001 From: Zaher Ghaibeh Date: Tue, 21 Jun 2022 18:53:04 +0300 Subject: [PATCH 2/2] fix a typo --- action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/action.yml b/action.yml index a4475df..300e2dc 100644 --- a/action.yml +++ b/action.yml @@ -15,7 +15,7 @@ inputs: required: false default: "FIXME" case-sensitive: - description: 'Whether the searchable terms pass to `git grep` should be case-sensitive or not.' + description: 'Whether the searchable terms passed to `git grep` should be case-sensitive or not.' required: false default: false