From 773eaf1636a9c1cf1580c0233f372ac1cf57b0b9 Mon Sep 17 00:00:00 2001 From: Zaher Ghaibeh Date: Mon, 20 Jun 2022 11:25:39 +0300 Subject: [PATCH 1/5] Make the terms configurable --- .github/workflows/test.yml | 2 ++ Dockerfile | 2 +- README.md | 22 +++++++++++++++++++--- action.yml | 7 ++++++- lib/entrypoint.sh | 4 ++-- 5 files changed, 30 insertions(+), 7 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index a6c6ff4..8ef489a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -12,5 +12,7 @@ jobs: steps: - uses: actions/checkout@v1 - uses: ./ + with: + terms: "wip|fix|fixme" env: ENVIRONMENT: test diff --git a/Dockerfile b/Dockerfile index 4fff6f4..76625cf 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,7 @@ FROM alpine/git:1.0.7 LABEL com.github.actions.name="FIXME check" -LABEL com.github.actions.description="Check your code for `FIXME` labels" +LABEL com.github.actions.description="Check code for specific terms (FIXME, WIP, etc.) and fail (with code annotations) if any are found." LABEL com.github.actions.icon="code" LABEL com.github.actions.color="yellow" diff --git a/README.md b/README.md index aa5abbc..4dc4a56 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,10 @@ # action-fixme-check -Checks the code base for any `FIXME:` (with the colon) and fails the check if -any are found. Useful if you want to make sure that you don't miss any required -changes in the code base before merging a PR. +Checks the code base for any terms ending with a colon, and fail the check if +any are found. The default term is `FIXME:`. You can add or change the terms +using the `term` parameter, see [Installation](#Installation) below. +Useful if you want to make sure that you don't miss any required changes in the +code base before merging a PR. It runs very fast, taking only a few seconds to finish even on a very large codebase. All files in the repository will be read, including binary files (it @@ -30,12 +32,26 @@ jobs: steps: - uses: actions/checkout@v1 - 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 - [Official workflow configuration docs](https://help.github.com/en/actions/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions) +## Testing words + +(Used for testing this action on itself.) + +- I am using `WIP:` here. +- 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 The `action-fixme-check` library is available as open source under the terms of diff --git a/action.yml b/action.yml index ee52056..7bc4942 100644 --- a/action.yml +++ b/action.yml @@ -1,5 +1,5 @@ name: 'FIXME alert' -description: 'Check code for `FIXME:` and fail (with annotations) if any are found.' +description: 'Check code for specific terms (FIXME, WIP, etc.) and fail (with code annotations) if any are found.' author: '@bbugh' branding: icon: 'list' @@ -7,3 +7,8 @@ branding: runs: using: 'docker' image: 'Dockerfile' +inputs: + terms: + description: 'The pipe-delimited searchable terms to pass as a regex group to `git grep`.' + required: false + default: "FIXME" diff --git a/lib/entrypoint.sh b/lib/entrypoint.sh index 2647bcc..616a3da 100755 --- a/lib/entrypoint.sh +++ b/lib/entrypoint.sh @@ -8,8 +8,8 @@ cp /git-grep-problem-matcher.json "$matcher_path" echo "::add-matcher::git-grep-problem-matcher.json" -tag="FIXME" -result=$(git grep --no-color -n -e "${tag}:") +tag=${INPUT_TERMS:=FIXME} +result=$(git grep --no-color --ignore-case --line-number --extended-regexp -e "(${tag})+(:)" :^.github) echo "${result}" From fa6438d9c182490d7749153ca10f8579744b05a7 Mon Sep 17 00:00:00 2001 From: Zaher Ghaibeh Date: Tue, 21 Jun 2022 18:23:49 +0300 Subject: [PATCH 2/5] update readme --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index 4dc4a56..5bb5819 100644 --- a/README.md +++ b/README.md @@ -34,7 +34,6 @@ 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 From a18cb8a3163e578389c084f8d8af8a221afb1f8e Mon Sep 17 00:00:00 2001 From: Zaher Ghaibeh Date: Tue, 21 Jun 2022 18:24:45 +0300 Subject: [PATCH 3/5] Preserve the empty line --- action.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/action.yml b/action.yml index 7bc4942..9288a71 100644 --- a/action.yml +++ b/action.yml @@ -12,3 +12,4 @@ inputs: description: 'The pipe-delimited searchable terms to pass as a regex group to `git grep`.' required: false default: "FIXME" + From 96fb8bdab3dc71849b8332a224ebc4c22129e4c2 Mon Sep 17 00:00:00 2001 From: Zaher Ghaibeh <27624+zaherg@users.noreply.github.com> Date: Tue, 21 Jun 2022 18:29:36 +0300 Subject: [PATCH 4/5] Update README.md Co-authored-by: Brian Bugh <438465+bbugh@users.noreply.github.com> --- README.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/README.md b/README.md index 5bb5819..4369625 100644 --- a/README.md +++ b/README.md @@ -48,8 +48,6 @@ 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 From 7dcad825e6c032024cae167c9075e591d2563659 Mon Sep 17 00:00:00 2001 From: Zaher Ghaibeh <27624+zaherg@users.noreply.github.com> Date: Tue, 21 Jun 2022 18:29:42 +0300 Subject: [PATCH 5/5] Update lib/entrypoint.sh Co-authored-by: Brian Bugh <438465+bbugh@users.noreply.github.com> --- lib/entrypoint.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/entrypoint.sh b/lib/entrypoint.sh index 616a3da..75d15b4 100755 --- a/lib/entrypoint.sh +++ b/lib/entrypoint.sh @@ -9,7 +9,7 @@ cp /git-grep-problem-matcher.json "$matcher_path" echo "::add-matcher::git-grep-problem-matcher.json" tag=${INPUT_TERMS:=FIXME} -result=$(git grep --no-color --ignore-case --line-number --extended-regexp -e "(${tag})+(:)" :^.github) +result=$(git grep --no-color --line-number --extended-regexp -e "(${tag})+(:)" :^.github) echo "${result}"