Skip to content

Commit 3b6a0da

Browse files
authored
Merge pull request #20 from rtCamp/add/do-not-scan-feature
Feature: Add provision to skip PHPCS scan on PRs
2 parents 0b20574 + c46a420 commit 3b6a0da

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ Now, next time you create a pull request or commit on an existing pull request,
4141

4242
By default, pull request will be reviwed using WordPress coding and documentation standards. You can change the default by passing different [PHPCS Coding Standard(s)](#phpcs-coding-standards) in line `args = ["WordPress-Core,WordPress-Docs"]`.
4343

44+
4. In case you want to skip PHPCS scanning in any pull request, add `[do-not-scan]` in the PR description. You can add it anywhere in the description and it will skip the action run for that pull request.
45+
4446
---
4547

4648
Side note: in the usage example, we have used `docker://rtcamp/action-phpcs-code-review:v2.0.0`, which is the docker image set up with automated builds on this repo. It will always have the latest code of this repo. Instead of using docker image you can also use the repo url in it: `rtCamp/action-phpcs-code-review@v2.0.0`. The disadvantage using the repo url is that GitHub actions now builds the docker image from url every time action is executed (does not cache the docker image after first run _by default_ as it used to do in beta. You need to cache them seprately). That consumes a fairly good amount of time in action run. Leading to a longer running job as well as more billing (if used in private repo).

main.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@ COMMIT_ID=$(cat $GITHUB_EVENT_PATH | jq -r '.pull_request.head.sha')
66

77
echo "COMMIT ID: $COMMIT_ID"
88

9+
PR_BODY=$(cat "$GITHUB_EVENT_PATH" | jq -r .pull_request.body)
10+
if [[ "$PR_BODY" == *"[do-not-scan]"* ]]; then
11+
echo "[do-not-scan] found in PR description. Skipping PHPCS scan."
12+
exit 0
13+
fi
914

1015
stars=$(printf "%-30s" "*")
1116

0 commit comments

Comments
 (0)