remove -q #1
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: PHP Code Standards | ||
on: | ||
workflow_call: | ||
inputs: | ||
version: | ||
type: string | ||
default: "^3.0" | ||
config: | ||
type: string | ||
default: "" | ||
path: | ||
type: string | ||
default: "." | ||
rules: | ||
type: string | ||
default: | | ||
{ | ||
"@PSR2": true, | ||
"array_syntax": {"syntax":"short"}, | ||
"concat_space": {"spacing":"one"}, | ||
"new_with_parentheses": true, | ||
"no_unused_imports": true, | ||
"ordered_imports": true, | ||
"return_type_declaration": {"space_before": "none"}, | ||
"single_quote": true, | ||
"single_space_around_construct": true, | ||
"cast_spaces": true, | ||
"whitespace_after_comma_in_array": true, | ||
"no_whitespace_in_blank_line": true, | ||
"binary_operator_spaces": {"default": "at_least_single_space"}, | ||
"no_extra_blank_lines": true | ||
} | ||
add-rules: | ||
type: string | ||
default: "{}" | ||
exclude-patterns: | ||
type: string | ||
default: "" | ||
permissions: | ||
contents: read | ||
jobs: | ||
php_code_standards: | ||
runs-on: ubuntu-latest | ||
name: PHP Code Standards | ||
env: | ||
CONFIG: ${{ inputs.config }} | ||
CONFIG_PATH: ${{ inputs.path }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Setup PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: '8.2' | ||
- if: ${{ startsWith(inputs.config, 'GoogleCloudPlatform/php-tools/') }} | ||
name: Install Google Cloud Tools | ||
run: | | ||
BRANCH=${CONFIG#GoogleCloudPlatform/php-tools/} | ||
composer global require google/cloud-tools:dev-${BRANCH#*@} -q | ||
echo "CONFIG=$HOME/.composer/vendor/google/cloud-tools/${BRANCH%@*}" >> $GITHUB_ENV | ||
- name: 'Setup jq' | ||
uses: dcarbone/install-jq-action@v2 | ||
- name: Run PHP CS Fixer | ||
run: | | ||
<<<<<<< Updated upstream | ||
composer global require friendsofphp/php-cs-fixer:${{ inputs.version }} -q | ||
export RULES=$(echo $'${{ inputs.rules }} ${{ inputs.add-rules }}'|tr -d '\n\t\r '|jq -s '.[0] * .[1]' -crM) | ||
export EXCLUDE_PATTERNS=$(echo $'${{ inputs.exclude-patterns }}'|tr -d '\n\t\r ') | ||
CMD_PATH=$([ "$EXCLUDE_PATTERNS" == "" ] && echo "$CONFIG_PATH") | ||
CONFIG_OR_RULES=$([ ! -z "$CONFIG" ] && echo "--config=$CONFIG" || echo --rules=$RULES) | ||
======= | ||
composer global require friendsofphp/php-cs-fixer:${{ inputs.version }} | ||
CONFIG="${{ inputs.config }}" | ||
RULES=$(echo $'${{ inputs.rules }} ${{ inputs.add-rules }}'|tr -d '\n\t\r '|jq -s '.[0] * .[1]' -crM) | ||
>>>>>>> Stashed changes | ||
echo "TEST" | ||
set -x | ||
~/.composer/vendor/bin/php-cs-fixer fix \ | ||
$CMD_PATH \ | ||
$CONFIG_OR_RULES \ | ||
--dry-run --diff |