Skip to content

Commit

Permalink
Merge pull request rtCamp#33 from artemeon/master
Browse files Browse the repository at this point in the history
Add option to skip linting
  • Loading branch information
mrrobot47 authored Jun 25, 2020
2 parents aa83c41 + 21e70b2 commit dd05b5e
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ By default, pull request will be reviwed using WordPress coding and documentatio

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.

5. In case you want to skip linting all files on every pull request, set `PHP_LINT` to `false`.

## GitHub Token Creation

You can create [GitHub Token from here](https://github.com/settings/tokens).
Expand All @@ -64,6 +66,7 @@ Private | Complete `repo` and `write:discussion` permissions | [Screenshot Pr
Variable | Default | Possible Values | Purpose
---------------|---------|-----------------------------|----------------------------------------------------
`SKIP_FOLDERS` | - | `tests`,`tests,.github` (Any other comma seprated top level directories in the repo) | If any specific folders should be ignored when scanning, then a comma seprated list of values should be added to this env variable.
`PHP_LINT` | `true` | `true` or `false`, *case insensitive* (Any unknown value is the same as passing `true`) | If the default automatic linting of all PHP files should be deactivated, then this env variable should be set to `false`.

## PHPCS Coding Standards

Expand Down
2 changes: 1 addition & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ description: 'This will run phpcs on PRs'
author: 'rtCamp'
runs:
using: 'docker'
image: 'docker://rtcamp/action-phpcs-code-review:v2.0.2'
image: 'docker://rtcamp/action-phpcs-code-review:v2.0.3'
branding:
icon: 'check-circle'
color: 'green'
9 changes: 7 additions & 2 deletions main.sh
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,12 @@ fi

/usr/games/cowsay "Running with the flag $phpcs_standard"

php_lint_option='--lint=true'
if [[ "$(echo "$PHP_LINT" | tr '[:upper:]' '[:lower:]')" = 'false' ]]; then
php_lint_option='--lint=false'
fi

echo "Running the following command"
echo "/home/rtbot/vip-go-ci-tools/vip-go-ci/vip-go-ci.php --repo-owner=$GITHUB_REPO_OWNER --repo-name=$GITHUB_REPO_NAME --commit=$COMMIT_ID --token=\$GH_BOT_TOKEN --phpcs-path=/home/rtbot/vip-go-ci-tools/phpcs/bin/phpcs --local-git-repo=/home/rtbot/github-workspace --phpcs=true $phpcs_standard $skip_folders_option --lint=true"
echo "/home/rtbot/vip-go-ci-tools/vip-go-ci/vip-go-ci.php --repo-owner=$GITHUB_REPO_OWNER --repo-name=$GITHUB_REPO_NAME --commit=$COMMIT_ID --token=\$GH_BOT_TOKEN --phpcs-path=/home/rtbot/vip-go-ci-tools/phpcs/bin/phpcs --local-git-repo=/home/rtbot/github-workspace --phpcs=true $phpcs_standard $skip_folders_option $php_lint_option"

gosu rtbot bash -c "/home/rtbot/vip-go-ci-tools/vip-go-ci/vip-go-ci.php --repo-owner=$GITHUB_REPO_OWNER --repo-name=$GITHUB_REPO_NAME --commit=$COMMIT_ID --token=$GH_BOT_TOKEN --phpcs-path=/home/rtbot/vip-go-ci-tools/phpcs/bin/phpcs --local-git-repo=/home/rtbot/github-workspace --phpcs=true $phpcs_standard $skip_folders_option --lint=true"
gosu rtbot bash -c "/home/rtbot/vip-go-ci-tools/vip-go-ci/vip-go-ci.php --repo-owner=$GITHUB_REPO_OWNER --repo-name=$GITHUB_REPO_NAME --commit=$COMMIT_ID --token=$GH_BOT_TOKEN --phpcs-path=/home/rtbot/vip-go-ci-tools/phpcs/bin/phpcs --local-git-repo=/home/rtbot/github-workspace --phpcs=true $phpcs_standard $skip_folders_option $php_lint_option"

0 comments on commit dd05b5e

Please sign in to comment.