Skip to content

Commit 388e00d

Browse files
committed
Merge branch 'develop' for v2.0.0
2 parents 3fc22ec + 3b6a0da commit 388e00d

File tree

3 files changed

+14
-11
lines changed

3 files changed

+14
-11
lines changed

Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ RUN set -eux; \
1515
cowsay \
1616
git \
1717
gosu \
18+
jq \
1819
php7.2-cli \
1920
php7.2-curl \
2021
php-xml \

README.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,12 @@ on: pull_request
2323

2424
jobs:
2525
phpcs:
26-
2726
runs-on: ubuntu-latest
28-
2927
steps:
3028
- uses: actions/checkout@v2
3129
with:
3230
ref: ${{ github.event.pull_request.head.sha }}
33-
- uses: rtCamp/action-phpcs-code-review@master
31+
- uses: docker://rtcamp/action-phpcs-code-review:v2.0.0
3432
env:
3533
GH_BOT_TOKEN: ${{ secrets.GH_BOT_TOKEN }}
3634
with:
@@ -43,6 +41,12 @@ Now, next time you create a pull request or commit on an existing pull request,
4341

4442
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"]`.
4543

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+
46+
---
47+
48+
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).
49+
4650
## GitHub Token Creation
4751

4852
You can create [GitHub Token from here](https://github.com/settings/tokens).

main.sh

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,15 @@
22

33
cd $GITHUB_WORKSPACE
44

5-
# Checkout to the latest commit of the PR. As the vip-go-ci runner needs the commit id from PR.
6-
# If ref matches *refs/pull*, then an additional PR commit has been added by GH actions, and needs to be skipped.
7-
if [[ "$GITHUB_REF" == *"refs/pull"* ]]; then
8-
COMMIT_ID=$(git log -n 1 --skip 1 --pretty=format:"%H")
9-
git checkout -b pr "$COMMIT_ID"
10-
else
11-
COMMIT_ID="$GITHUB_SHA"
12-
fi
5+
COMMIT_ID=$(cat $GITHUB_EVENT_PATH | jq -r '.pull_request.head.sha')
136

147
echo "COMMIT ID: $COMMIT_ID"
158

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
1614

1715
stars=$(printf "%-30s" "*")
1816

0 commit comments

Comments
 (0)