File tree Expand file tree Collapse file tree 3 files changed +97
-0
lines changed Expand file tree Collapse file tree 3 files changed +97
-0
lines changed Original file line number Diff line number Diff line change 1+ <img src =" http://159.65.210.101/php-actions.png " align =" right " alt =" PHP Actions for Github " />
2+
3+ Run PHP Code Sniffer tests in Github Actions.
4+ =============================================
5+
6+ // TODO.
Original file line number Diff line number Diff line change 1+ name : PHP Code Sniffer (php-actions)
2+ description : Run your PHP Code Sniffer tests in your Github Actions.
3+
4+ inputs :
5+ version :
6+ description : What version of PHPCS to use
7+ default : latest
8+ required : false
9+
10+ php_version :
11+ description : What version of PHP to use
12+ default : latest
13+ required : false
14+
15+ vendored_phpcs_path :
16+ description : Path to a vendored phpcs binary
17+ required : false
18+
19+ path :
20+ description : One or more files and/or directories to check
21+ required : true
22+
23+ standard :
24+ description : The name or path of the coding standard to use
25+ required : true
26+
27+ args :
28+ description : Extra arguments to pass to the phpcs binary
29+ required : false
30+
31+ runs :
32+ using : " composite"
33+ steps :
34+ - env :
35+ ACTION_TOKEN : ${{ github.token }}
36+ ACTION_VERSION : ${{ inputs.version }}
37+ ACTION_PHP_VERSION : ${{ inputs.php_version }}
38+ ACTION_PHPCS_PATH : ${{ inputs.vendored_phpcs_path }}
39+ ACTION_PATH : ${{ inputs.path }}
40+ ACTION_STANDARD : ${{ inputs.standard }}
41+ ACTION_ARGS : ${{ inputs.args }}
42+
43+ id : phpcs_run
44+ run : |
45+ set -e
46+ bash <(curl -s https://raw.githubusercontent.com/php-actions/php-build/cee5b9fa9fbc4c888e7a62bbb7b8eade18e3c56b/php-build.bash) phpcs
47+ ${{ github.action_path }}/phpcs-action.bash
48+ shell : bash
49+
50+ branding :
51+ icon : ' check-square'
52+ color : ' purple'
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+ set -e
3+ github_action_path=$( dirname " $0 " )
4+ docker_tag=$( cat ./docker_tag)
5+
6+ if [ -z " $ACTION_PHPCS_PATH " ]
7+ then
8+ phar_url=" https://www.getrelease.download/squizlabs/PHP_CodeSniffer/$ACTION_VERSION /phpcs.phar"
9+ phar_path=" ${github_action_path} /phpcs.phar"
10+ curl --silent -H " User-agent: cURL (https://github.com/php-actions)" -L " $phar_url " > " $phar_path "
11+ else
12+ phar_path=" ${GITHUB_WORKSPACE} /$ACTION_PHPCS_PATH "
13+ fi
14+
15+ chmod +x $phar_path
16+ command_string=(" phpcs" )
17+
18+ if [ -n " $ACTION_PATH " ]
19+ then
20+ command_string+=(" $ACTION_PATH " )
21+ fi
22+
23+ if [ -n " $ACTION_STANDARD " ]
24+ then
25+ command_string+=(--standard=" $ACTION_STANDARD " )
26+ fi
27+
28+ if [ -n " $ACTION_ARGS " ]
29+ then
30+ command_string+=($ACTION_ARGS )
31+ fi
32+
33+ docker run --rm \
34+ --volume " ${phar_path} " :/usr/local/bin/phpcs \
35+ --volume " ${GITHUB_WORKSPACE} " :/app \
36+ --workdir /app \
37+ --network host \
38+ --env-file <( env| cut -f1 -d= ) \
39+ ${docker_tag} " ${command_string[@]} " && echo " PHPCS completed successfully"
You can’t perform that action at this time.
0 commit comments